From:             junker at slooz dot com
Operating system: Windows XP
PHP version:      5.3CVS-2008-05-10 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  Scripting stops after calling a magic setter from a static 
function

Description:
------------
Magic __set function fails when called from a static method.

The sample code will work as expected if "$o->Dummy = $o2;" is replaced
with, for example, "$o->Dummy = 'abc';".

Reproduce code:
---------------
<?
        class A {       
                public static function who () { return __CLASS__; }     
                public static function create () {
                        $type = static::who ();
                        $o = new $type ();                      
                        if ($type == 'B') {
                                $o2 = C::create ();
                                $o->Dummy = $o2;
                        }
                        return $o;
                }               
                public function __set ($key, $value) {
                        echo "[setting $key]";
                }
        }       
        class B extends A {public static function who () { return __CLASS__; }} 
        class C extends A {public static function who () { return __CLASS__; }} 
        $obj_b = B::create (); echo '[Done]';
?>

Expected result:
----------------
[setting Dummy][Done]

Actual result:
--------------
No output. The scripting of the code seems to stop during this command:
$o->Dummy = $o2;

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

Reply via email to