#21845 [Ver->Opn]: $this in static calls

From: Date: Thu, 13 Mar 2003 21:10:47 +0000
Subject: #21845 [Ver->Opn]: $this in static calls
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14268@lists.php.net to get a copy of this message
ID: 21845 Updated by: mj@php.net Reported By: cynic@php.net -Status: Verified +Status: Open Bug Type: PEAR related Operating System: FreeBSD-4.7 STABLE PHP Version: 4.3.0 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-03-08 09:14:08] alan_k@php.net I think Andi confirmed this behaviour will disappear in PHP5 (the $this transfer on static methods), Probably worth emailing Stig or pear-dev to confirm that nobody has a problem with this (patch looks ok to me) ------------------------------------------------------------------------ [2003-01-23 10:27:30] cynic@php.net I'm sure I've seen this discussed on php-dev@, but cannot find it for the life of me, nor do I recall the conclusion. class foo { function bar () { baz::quux(); } } class baz { function quux() { printf('$this is %s set', isset($this)?'':'not') } } PEAR_Error::throwError() suffers from this bug. two alternate patches: Index: pear/PEAR.php =================================================================== RCS file: /repository/php4/pear/PEAR.php,v retrieving revision 1.53 diff -u -u -r1.53 PEAR.php --- pear/PEAR.php 21 Jan 2003 13:32:34 -0000 1.53 +++ pear/PEAR.php 23 Jan 2003 16:20:52 -0000 @@ -528,7 +528,7 @@ $code = null, $userinfo = null) { - if (isset($this)) { + if (isset($this) && is_subclass_of($this, 'PEAR_Error')) { return $this->raiseError($message, $code, null, null, $userinfo); } else { return PEAR::raiseError($message, $code, null, null, $userinfo); Index: pear/PEAR.php =================================================================== RCS file: /repository/php4/pear/PEAR.php,v retrieving revision 1.53 diff -u -u -r1.53 PEAR.php --- pear/PEAR.php 21 Jan 2003 13:32:34 -0000 1.53 +++ pear/PEAR.php 23 Jan 2003 16:20:34 -0000 @@ -528,7 +528,7 @@ $code = null, $userinfo = null) { - if (isset($this)) { + if (isset($this) && method_exists($this, 'raiseError')) { return $this->raiseError($message, $code, null, null, $userinfo); } else { return PEAR::raiseError($message, $code, null, null, $userinfo); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21845&edit=1

« previous php.pear.dev (#14268) next »