[2010年06月17日 16:40 UTC] jbwdevries at gmail dot com
Description: ------------ get_defined_vars() only contains the $this variable entry when $this is assigned or returned. In all other cases (no use, gettting or setting of property, callign a method) the $this entry is missing from the list. Test script: --------------- // Full example is at http://pastebin.com/FDJzCTRG class Test { //... public function testNoThis() { echo __METHOD__ . PHP_EOL; var_dump(array_keys(get_defined_vars())); } //... } $t = new Test(); $t->testNoThis(); Expected result: ---------------- Test::testNoThis array(1) { [0]=> string(4) "this" } Test::testThisGet array(1) { [0]=> string(4) "this" } Test::testThisSet array(1) { [0]=> string(4) "this" } Test::testThisCall array(1) { [0]=> string(4) "this" } Test::testThisUse array(1) { [0]=> string(4) "this" } Actual result: -------------- Test::testNoThis array(0) { } Test::testThisGet array(0) { } Test::testThisSet array(0) { } Test::testThisCall array(0) { } Test::testThisUse array(1) { [0]=> string(4) "this" } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010年06月17日 17:05 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010年06月17日 17:05 UTC] johannes@php.net
[2010年06月17日 17:10 UTC] jbwdevries at gmail dot com
|