#21845 [NEW]: $this in static calls

From: Date: Thu, 23 Jan 2003 16:27:30 +0000
Subject: #21845 [NEW]: $this in static calls
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-12685@lists.php.net to get a copy of this message
From: cynic@php.net Operating system: FreeBSD-4.7 STABLE PHP version: 4.3.0 PHP Bug Type: PEAR related Bug description: $this in static calls 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 bug report at http://bugs.php.net/?id=21845&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21845&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21845&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21845&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21845&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21845&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21845&r=support Expected behavior: http://bugs.php.net/fix.php?id=21845&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21845&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21845&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21845&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21845&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21845&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21845&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=21845&r=gnused

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