From:             stas at zend dot com
Operating system: *
PHP version:      5.2CVS-2007-11-05 (CVS)
PHP Bug Type:     Scripting Engine problem
Bug description:  Crash on using unitialized vals and __get/__set

Description:
------------
Code modifying the result of __get (erroneously) and using undefined
variables crashes, apparently because of unitialized_zval being freed. 

Reproduce code:
---------------
<?php
class Foo {
        function __get($k) {
                return null;
        }
        function __set($k, $v) {
                $this->$k = $v;
        }
}

$c = new Foo();

$c->arr[0]["k"] = 1;
$c->arr[0]["k2"] = $ref;
for($cnt=0;$cnt<6;$cnt++) {
        $ref = chop($undef);    
        $c->arr[$cnt]["k2"] = $ref;
}
?>

Expected result:
----------------
No crash :)

Actual result:
--------------
On windows - crash
On Unix debug - 
php5/Zend/zend_hash.c(517) : ht=0xa533520 is being destroyed


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

Reply via email to