Req #77135 [NEW]: Extract with EXTR_SKIP should skip $this
| From: | thflori at gmail dot com | Date: | Sat, 10 Nov 2018 10:27:16 +0000 |
| Subject: | Req #77135 [NEW]: Extract with EXTR_SKIP should skip $this | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217889@lists.php.net to get a copy of this message | ||
From: thflori at gmail dot com
Operating system: Manjaro
PHP version: 7.2.12
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Extract with EXTR_SKIP should skip $this
Description:
------------
I know that get_defined_vars() is not returning $this but for every
developer it feels like a variable that is currently defined inside an
object context.
As you can never overwrite $this - even outside an object context it
would make sense that the extract function always work as $this is
defined and use the appropriate method (skip/prefix).
Test script:
---------------
<?php
$arr = ['this' => 'hello world'];
extract($arr, EXTR_SKIP);
extract($arr, EXTR_PREFIX_INVALID, 'v_');
var_dump($v_hello === $arr['this']);
Expected result:
----------------
bool(true)
Actual result:
--------------
PHP Fatal error: Uncaught Error: Cannot re-assign $this in
/tmp/test.php:4
Stack trace:
#0 /tmp/test.php(4): extract(Array, 1)
#1 {main}
thrown in /tmp/test.php on line 4
--
Edit bug report at https://bugs.php.net/bug.php?id=77135&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77135&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77135&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77135&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77135&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77135&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77135&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77135&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77135&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77135&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77135&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77135&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77135&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77135&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77135&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77135&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77135&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77135&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77135&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77135&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77135&r=mysqlcfg