php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32231 zend_objects_clone_obj ( Exception ) => segfault
Submitted: 2005-03-08 12:00 UTC Modified: 2005-03-29 11:44 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bugs at niluje dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.0.3 OS: Debian linux x86
Private report: No CVE-ID: None
 [2005-03-08 12:00 UTC] bugs at niluje dot net
Description:
------------
var_dump() on an exception crashes php5.


#0  0xb57f0c0e in zend_objects_clone_obj () from /usr/lib/apache/1.3/libphp5.so
(gdb) bt
#0  0xb57f0c0e in zend_objects_clone_obj () from /usr/lib/apache/1.3/libphp5.so
#1  0xb577f00d in php_var_dump () from /usr/lib/apache/1.3/libphp5.so
#2  0xb577ee3f in url_adapt () from /usr/lib/apache/1.3/libphp5.so
#3  0xb57e5986 in zend_hash_apply_with_arguments () from /usr/lib/apache/1.3/libphp5.so
#4  0xb577f0b7 in php_var_dump () from /usr/lib/apache/1.3/libphp5.so
#5  0xb577f1d6 in zif_var_dump () from /usr/lib/apache/1.3/libphp5.so
#6  0xb581b851 in zend_do_fcall_common_helper () from /usr/lib/apache/1.3/libphp5.so
#7  0xb581bfd0 in zend_do_fcall_handler () from /usr/lib/apache/1.3/libphp5.so
#8  0xb580024f in execute () from /usr/lib/apache/1.3/libphp5.so
#9  0xb57df043 in zend_execute_scripts () from /usr/lib/apache/1.3/libphp5.so
#10 0xb57a8c55 in php_execute_script () from /usr/lib/apache/1.3/libphp5.so
#11 0xb5824755 in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#12 0xb582537e in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#13 0xb58253e5 in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#14 0x080553c3 in ap_invoke_handler ()
#15 0x08068465 in ap_some_auth_required ()
#16 0x08068614 in ap_process_request ()
#17 0x08060bd2 in ap_child_terminate ()
#18 0x08060de7 in ap_child_terminate ()
#19 0x080610c7 in ap_child_terminate ()
#20 0x08061a48 in ap_child_terminate ()
#21 0x08061ff8 in main ()




Reproduce code:
---------------
catch (Exception $e) {
 var_dump ($e);
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-09 00:40 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Your example script gives me this output:

Parse error: syntax error, unexpected T_CATCH in Command line code on line 1

 [2005-03-24 17:45 UTC] bugs at niluje dot net
here is a test case to trigger the segfault :

you need PEAR, DB, DB_Dataobject:


test.php
----------------------
<?php
        require_once 'PEAR.php';
        require_once 'DB/DataObject.php';
        PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);

        $config = parse_ini_file('dao.ini', TRUE);
        foreach($config as $class=>$values) {
                $options = &PEAR::getStaticProperty($class, 'options');
                $options = $values;
        }

        $options = &PEAR::getStaticProperty('DB_DataObject','options');
        $options['class_prefix'] = '';
        $options['persistent'] = true;

        class Test extends DB_Dataobject
        {
                public $__table = 'test';
        }


        $dao = new Test();

        try {
                $dao->field1 = 'test';
                $dao->insert();
        }
        catch (Exception $e)
        {
                var_dump($e);
        }

?>
-----------


dao.ini
---------
[DB_DataObject]
debug = 1
database_test                   = mysqli://root@localhost/test
table_test                      = test
---------


gdb backtrace:
-----------
#0  0xb57f0c0e in zend_objects_clone_obj () from /usr/lib/apache/1.3/libphp5.so
#0  0xb57f0c0e in zend_objects_clone_obj () from /usr/lib/apache/1.3/libphp5.so
#1  0xb577f00d in php_var_dump () from /usr/lib/apache/1.3/libphp5.so
#2  0xb577ee3f in url_adapt () from /usr/lib/apache/1.3/libphp5.so
#3  0xb57e5986 in zend_hash_apply_with_arguments () from /usr/lib/apache/1.3/libphp5.so
#4  0xb577f0b7 in php_var_dump () from /usr/lib/apache/1.3/libphp5.so
#5  0xb577f1d6 in zif_var_dump () from /usr/lib/apache/1.3/libphp5.so
#6  0xb581b851 in zend_do_fcall_common_helper () from /usr/lib/apache/1.3/libphp5.so
#7  0xb581bfd0 in zend_do_fcall_handler () from /usr/lib/apache/1.3/libphp5.so
#8  0xb580024f in execute () from /usr/lib/apache/1.3/libphp5.so
#9  0xb57df043 in zend_execute_scripts () from /usr/lib/apache/1.3/libphp5.so
#10 0xb57a8c55 in php_execute_script () from /usr/lib/apache/1.3/libphp5.so
#11 0xb5824755 in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#12 0xb582537e in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#13 0xb58253e5 in apache_php_module_main () from /usr/lib/apache/1.3/libphp5.so
#14 0x080553c3 in ap_invoke_handler ()
#15 0x08068465 in ap_some_auth_required ()
#16 0x08068614 in ap_process_request ()
#17 0x08060bd2 in ap_child_terminate ()
#18 0x08060de7 in ap_child_terminate ()
#19 0x08060f10 in ap_child_terminate ()
#20 0x08061a9a in ap_child_terminate ()
#21 0x08061ff8 in main ()
------------------------
 [2005-03-24 18:40 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-03-24 18:40 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2005-03-24 18:41 UTC] sniper@php.net
Please read the above 2 comments I added. Read them very carefully..


 [2005-03-29 11:33 UTC] bugs at niluje dot net
i do not have the time or the expertise to compile php with debug options.

the segfault happends in PEAR.php (PEAR 1.3.5) line 863

eval('$e = new Exception($this->message, $this->code);$e->PEAR_Error = $this;throw($e);');

it appears that $e->PEAR_Error = $this causes the segfault.
 [2005-03-29 11:41 UTC] sniper@php.net
And we don't have time to come up with simple reproducing scripts either.

 [2005-03-29 11:44 UTC] bugs at niluje dot net
you have the expertise to do so, i don't. don't get me wrong i have spent a considerable amount of time trying to find the bug, i can't do much more.

i have enough trouble explaining my boss why php crashes as it is supposed to be production ready.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC