|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-13 02:19 UTC] php at bobsilva dot com
[2004-10-13 09:21 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 09:00:01 2025 UTC |
Description: ------------ If you call an object's method, $x->foo(), and then call parent:;bar() (or self:;bar() or xyz::abc()), $this will be defined inside bar() and point to the original object ($x). But if you use call_user_func() or call_user_func_array(), $this is not defined. Reproduce code: --------------- class foo { function a() { if (isset($this)) var_dump($this); else print "\$this not defined.\n"; } function b() { self::a(); call_user_func(array('self','a')); } } $x = new foo; $x->b(); Expected result: ---------------- object(foo)#1 (0) { } object(foo)#1 (0) { } Actual result: -------------- object(foo)#1 (0) { } $this not defined.