#24884 [Ver->Csd]: calling $this->__clone(); crashes php
| From: | stas@php.net | Date: | Mon, 04 Aug 2003 09:11:16 +0000 |
| Subject: | #24884 [Ver->Csd]: calling $this->__clone(); crashes php | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45290@lists.php.net to get a copy of this message | ||
ID: 24884
Updated by: stas@php.net
Reported By: auroraeosrose at hotmail dot com
-Status: Verified
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: *
PHP Version: 5CVS-2003-08-02 (dev)
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-01 20:48:06] sniper@php.net
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (runnable)]
0x8381fd4 in zend_clone_handler (execute_data=0xbfffd1ec,
op_array=0x41c760b0)
at /usr/src/web/php/php5/Zend/zend_execute.c:3042
3042 if (Z_TYPE_P(obj) != IS_OBJECT) {
(gdb) bt
#0 0x8381fd4 in zend_clone_handler (execute_data=0xbfffd1ec,
op_array=0x41c760b0)
at /usr/src/web/php/php5/Zend/zend_execute.c:3042
#1 0x837b22b in execute (op_array=0x41c760b0) at
/usr/src/web/php/php5/Zend/zend_execute.c:1199
#2 0x8380278 in zend_do_fcall_common_helper (execute_data=0xbfffd4dc,
op_array=0x41c72d60)
at /usr/src/web/php/php5/Zend/zend_execute.c:2529
#3 0x83806ee in zend_do_fcall_by_name_handler
(execute_data=0xbfffd4dc, op_array=0x41c72d60)
at /usr/src/web/php/php5/Zend/zend_execute.c:2602
#4 0x837b22b in execute (op_array=0x41c72d60) at
/usr/src/web/php/php5/Zend/zend_execute.c:1199
#5 0x835a174 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/web/php/php5/Zend/zend.c:1032
#6 0x8313b6e in php_execute_script (primary_file=0xbffff870) at
/usr/src/web/php/php5/main/main.c:1573
#7 0x83959df in main (argc=3, argv=0xbffff8e4) at
/usr/src/web/php/php5/sapi/cli/php_cli.c:910
#8 0x4055b9cb in __libc_start_main (main=0x8394c04 <main>, argc=3,
argv=0xbffff8e4, init=0x80b5b6c <_init>,
fini=0x84f3f94 <_fini>, rtld_fini=0x4000aea0 <_dl_fini>,
stack_end=0xbffff8dc)
at ../sysdeps/generic/libc-start.c:92
------------------------------------------------------------------------
[2003-07-31 09:40:19] auroraeosrose at hotmail dot com
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 this bug report at http://bugs.php.net/?id=24884&edit=1