Req #77135 [Opn->Csd]: Extract with EXTR_SKIP should skip $this

From: Date: Fri, 07 Jun 2019 08:51:14 +0000
Subject: Req #77135 [Opn->Csd]: Extract with EXTR_SKIP should skip $this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221180@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77135&edit=1 ID: 77135 Updated by: dmitry@php.net Reported by: thflori at gmail dot com Summary: Extract with EXTR_SKIP should skip $this -Status: Open +Status: Closed Type: Feature/Change Request Package: *General Issues Operating System: Manjaro PHP Version: 7.2.12 Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=83cdb89f8a6cbc656f2f95aeb6ce1c97691e197f Log: Fixed bug #77135 (Extract with EXTR_SKIP should skip $this) Previous Comments: ------------------------------------------------------------------------ [2018-11-10 10:27:16] thflori at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=77135&edit=1

« previous php.bugs (#221180) next »