From:             toomuchphp-phpbugs at yahoo dot com
Operating system: 
PHP version:      5.1.4
PHP Bug Type:     Class/Object related
Bug description:  Misleading error message for recursive use of __get()

Description:
------------
Recursive use of __get() results in the misleading error message "Notice:
Undefined property:  someClass::$foo in file.php".  It appears at first as
though __get() is not being called for some properties and there is no
apparent reason why, when the problem is really accidental recursion. PHP
correctly detects the recursion and aborts __get(), but the error gives no
indication of the recursion problem and it can be very difficult to figure
out why __get() is not being called.

I can provide a fix for zend_object_handlers.c, but it really is just a
60-second change to capture the recursiveness error and output an
alternative error message.


Reproduce code:
---------------
class test {
    function __get($var) {
        return $this->$var;
    }
}

$obj = new test;
echo $obj->foo;

Expected result:
----------------
Warning: Recursive use of __get() while accessing test::$foo; cannot read
property recursive::$foo in <file> on line x

Actual result:
--------------
Notice: Undefined property:  test::$foo in <file> on line x

-- 
Edit bug report at http://bugs.php.net/?id=38122&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38122&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38122&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38122&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38122&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38122&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38122&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38122&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38122&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38122&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38122&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38122&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38122&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38122&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38122&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38122&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38122&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38122&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38122&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38122&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38122&r=mysqlcfg

Reply via email to