#19980 [Bgs->Opn]: Static method call from non-statiic method fails.

From: Date: Mon, 21 Oct 2002 08:34:20 +0000
Subject: #19980 [Bgs->Opn]: Static method call from non-statiic method fails.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22940@lists.php.net to get a copy of this message
ID: 19980 User updated by: xczimi@sztaki.hu Reported By: xczimi@sztaki.hu -Status: Bogus +Status: Open Bug Type: Scripting Engine problem Operating System: Win2000 PHP Version: 4.2.3 New Comment: The example on the manual is correct, but here, the class A and the class B do not extend each other (they donot know anything about each other logically), so I do not think in a function of B the $this may be an object of class A. Where can I find ZE2 list? Previous Comments: ------------------------------------------------------------------------ [2002-10-18 19:46:29] mfischer@php.net This came up on ZE2 list also, people seem to have a need for this. Please participate there. ------------------------------------------------------------------------ [2002-10-18 15:43:16] sniper@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php ------------------------------------------------------------------------ [2002-10-18 10:31:45] xczimi@sztaki.hu AyByBn ------------------------------------------------------------------------ [2002-10-18 10:26:31] tal@php.net And the output is? ------------------------------------------------------------------------ [2002-10-18 10:07:33] xczimi@sztaki.hu when calling B::procSave from $a->procSave() the $this keeps linked to $a. The code: <?php class A { function A() {} function procSave() { echo "A"; if(isset($this)) echo "y"; else echo "n"; B::procSave(); } } class B { function B() {} function procSave() { echo "B"; if(isset($this)) echo "y"; else echo "n"; } } $a = new A(); $b = new B(); $a->procSave(); B::procSave(); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19980&edit=1

« previous php.bugs (#22940) next »