#21845 [Asn->Csd]: $this in static calls
| From: | cellog@php.net | Date: | Wed, 13 Aug 2003 20:36:57 +0000 |
| Subject: | #21845 [Asn->Csd]: $this in static calls | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19690@lists.php.net to get a copy of this message | ||
ID: 21845
Updated by: cellog@php.net
Reported By: cynic@php.net
-Status: Assigned
+Status: Closed
Bug Type: PEAR related
Operating System: na
PHP Version: 4.3.2
Assigned To: cellog
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-08-08 14:24:11] cellog@php.net
This bug renders setErrorHandling() useless inside a class that doesn't
extend PEAR, and is therefore kind of important. I'd like to commit
the patch I posted previously for 4.3.3's release. All it does is
change the test of if (isset($this)) to if (isset($this) &&
(get_class($this) == 'pear' || is_subclass_of($this, 'pear'))),
ensuring correct behavior (the static handling should be used in a
class that is not a PEAR descendant)
Greg
------------------------------------------------------------------------
[2003-07-31 15:28:02] cellog@php.net
There are a few other functions that need a similar patch. If it looks
good, I'm happy to commit this patch.
Greg
Index: pear/PEAR.php
===================================================================
RCS file: /repository/php-src/pear/PEAR.php,v
retrieving revision 1.65
diff -u -r1.65 PEAR.php
--- pear/PEAR.php 10 Jul 2003 11:35:37 -0000 1.65
+++ pear/PEAR.php 31 Jul 2003 20:25:56 -0000
@@ -289,7 +289,8 @@
function setErrorHandling($mode = null, $options = null)
{
- if (isset($this)) {
+ if (isset($this) &&
+ (get_class($this) == 'pear' || is_subclass_of($this,
'pear'))) {
$setmode = &$this->_default_error_mode;
$setoptions = &$this->_default_error_options;
} else {
@@ -566,7 +567,8 @@
function pushErrorHandling($mode, $options = null)
{
$stack = &$GLOBALS['_PEAR_error_handler_stack'];
- if (isset($this)) {
+ if (isset($this) &&
+ (get_class($this) == 'pear' || is_subclass_of($this,
'pear'))) {
$def_mode = &$this->_default_error_mode;
$def_options = &$this->_default_error_options;
} else {
@@ -575,7 +577,8 @@
}
$stack[] = array($def_mode, $def_options);
- if (isset($this)) {
+ if (isset($this) &&
+ (get_class($this) == 'pear' || is_subclass_of($this,
'pear'))) {
$this->setErrorHandling($mode, $options);
} else {
PEAR::setErrorHandling($mode, $options);
@@ -600,7 +603,8 @@
array_pop($stack);
list($mode, $options) = $stack[sizeof($stack) - 1];
array_pop($stack);
- if (isset($this)) {
+ if (isset($this) &&
+ (get_class($this) == 'pear' || is_subclass_of($this,
'pear'))) {
$this->setErrorHandling($mode, $options);
} else {
PEAR::setErrorHandling($mode, $options);
------------------------------------------------------------------------
[2003-03-13 15:29:12] mj@php.net
throwError() has been patched for now.
------------------------------------------------------------------------
[2003-03-13 15:23:29] cynic@php.net
*what* was fixed? was the $this transfer fixed, or was
PEAR_Error::throwError() patched to work around it?
------------------------------------------------------------------------
[2003-03-13 15:10:47] mj@php.net
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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/21845
--
Edit this bug report at http://bugs.php.net/?id=21845&edit=1