From:             auroraeosrose at hotmail dot com
Operating system: Win XP Pro SP1
PHP version:      5CVS-2003-07-31 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  calling $this->__clone(); crashes php

Description:
------------
calling $this->__clone(); inside a class crashes php

Latest CVS snapshot, apache 2 filter, gd, mbstring, and mysql dlls

Reason for calling it is attempting to create a backward compatible
solution for cloning objects without a 5 ini setting change or seperate 4
and 5 codebases

Reproduce code:
---------------
<?php
class Test {
        function __copy()
        {
                $string = PHP_VERSION;
                $version = $string{0};
                if($string < 5)
                {
                        return $this;
                }
                else
                {
                        return $this->__clone();
                }
        }
}
$test = new Test();
$test2 = $test->__copy();
?>

Expected result:
----------------
If using php4, a copy of the object will be returned, if using php5, the
current object should be cloned and returned.

Actual result:
--------------
php and apache die
actually calling $this->__clone(); anywhere in a class crashes  

-- 
Edit bug report at http://bugs.php.net/?id=24884&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24884&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24884&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24884&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24884&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24884&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24884&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24884&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24884&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24884&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24884&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24884&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24884&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24884&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24884&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24884&r=gnused

Reply via email to