Doc #74418 [NEW]: missing from doc: extract() doesn't change $this in a method

From: Date: Wed, 12 Apr 2017 04:43:54 +0000
Subject: Doc #74418 [NEW]: missing from doc: extract() doesn't change $this in a method
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14612@lists.php.net to get a copy of this message
From: csongor at halmai dot hu Operating system: PHP version: 5.6.30 Package: Documentation problem Bug Type: Documentation Problem Bug description:missing from doc: extract() doesn't change $this in a method Description: ------------ --- From manual page: http://www.php.net/function.extract --- There is some non-documented behaviour when $array has a "this" key. If extract($array) is invoked within an object method then $this is not overwritten. This is totally understandable but - it should be documented - it should raise a notice If extract() is invoked NOT within a method then $this is created. This looks logical but it contradicts the fact that $this cannot be created with a simple assignment. If this is an intended behaviour then it also should be documented, otherwise this is a bug. Test script: --------------- <?php $array = array( "this" => "NOT THIS" ); error_reporting(E_ALL); class C { function t($arr) { extract($arr); print "this:"; print_r($this); // displays the object, not "NOT THIS", as one would expect } } $c = new C(); $c->t($array); extract($array); // it creates $this print $this; // $this = 0; // this line would raise a Fatal Error -- Edit bug report at https://bugs.php.net/bug.php?id=74418&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74418&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74418&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74418&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74418&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74418&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74418&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74418&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74418&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74418&r=support Expected behavior: https://bugs.php.net/fix.php?id=74418&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74418&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74418&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74418&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74418&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74418&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74418&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74418&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74418&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74418&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74418&r=mysqlcfg

« previous php.doc.bugs (#14612) next »