From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.7
PHP version:      5CVS-2003-01-30 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  get_parent_class segfault

Additionals:
Apache 1.3.27-mod_ssl

Script to reproduce:
<?php

class man
{
        var $name, $bars;
        function man()
        {
                $this->name = 'Mr. X';
                $this->bars = array();
        }

        function getdrunk($where)
        {
                $this->bars[] = new bar($where);
        }

        function getName()
        {
                return $this->name;
        }
}

class bar extends man
{
        var $name;

        function bar($w)
        {
                $this->name = $w;
        }

        function getName()
        {
                return $this->name;
        }

        function whosdrunk()
        {
                $who = get_parent_class($this);
                if($who == NULL)
                {
                        return 'nobody';
                }
                return eval($who.'::getName()');
        }
}

$x = new man;
$x->getdrunk('The old Tavern');
$x->bars[0]->whosdrunk();
?>

Backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x28586642 in zif_get_parent_class (ht=1, return_value=0x8104858,
this_ptr=0x0, return_value_used=1)
    at /home/mdev/cvs/php5/Zend/zend_builtin_functions.c:563
563                             name = ce->name;
#0  0x28586642 in zif_get_parent_class (ht=1, return_value=0x8104858,
this_ptr=0x0, return_value_used=1)
    at /home/mdev/cvs/php5/Zend/zend_builtin_functions.c:563
#1  0x28594f5b in zend_do_fcall_common_helper (execute_data=0xbfbfe0bc,
op_array=0x8106850)
    at /home/mdev/cvs/php5/Zend/zend_execute.c:2620
#2  0x285956a5 in zend_do_fcall_handler (execute_data=0xbfbfe0bc,
op_array=0x8106850)
    at /home/mdev/cvs/php5/Zend/zend_execute.c:2748
#3  0x2858f5c7 in execute (op_array=0x8106850) at
/home/mdev/cvs/php5/Zend/zend_execute.c:1227
#4  0x28595158 in zend_do_fcall_common_helper (execute_data=0xbfbfe39c,
op_array=0x810388c)
    at /home/mdev/cvs/php5/Zend/zend_execute.c:2654
#5  0x28595577 in zend_do_fcall_by_name_handler (execute_data=0xbfbfe39c,
op_array=0x810388c)
    at /home/mdev/cvs/php5/Zend/zend_execute.c:2718
#6  0x2858f5c7 in execute (op_array=0x810388c) at
/home/mdev/cvs/php5/Zend/zend_execute.c:1227
#7  0x2857b7b0 in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /home/mdev/cvs/php5/Zend/zend.c:996
#8  0x2853d0dc in php_execute_script (primary_file=0xbfbff944) at
/home/mdev/cvs/php5/main/main.c:1699
#9  0x2859be4a in apache_php_module_main (r=0x809f038,
display_source_mode=0)
    at /home/mdev/cvs/php5/sapi/apache/sapi_apache.c:55
#10 0x2859ce90 in send_php (r=0x809f038, display_source_mode=0, 
    filename=0x80a0b08 "/usr/local/www/data/bug.php") at
/home/mdev/cvs/php5/sapi/apache/mod_php4.c:608
#11 0x2859cf03 in send_parsed_php (r=0x809f038) at
/home/mdev/cvs/php5/sapi/apache/mod_php4.c:623
#12 0x8053688 in ap_invoke_handler (r=0x809f038) at http_config.c:518
#13 0x80631a9 in process_request_internal (r=0x809f038) at
http_request.c:1308
#14 0x8063208 in ap_process_request (r=0x809f038) at http_request.c:1324
#15 0x805c63e in child_main (child_num_arg=0) at http_main.c:4689
#16 0x805c7d0 in make_child (s=0x8099038, slot=0, now=1043934649) at
http_main.c:4813
#17 0x805c8ed in startup_children (number_to_start=5) at http_main.c:4895
#18 0x805cddc in standalone_main (argc=3, argv=0xbfbffc4c) at
http_main.c:5203
#19 0x805d4d7 in main (argc=3, argv=0xbfbffc4c) at http_main.c:5566
(gdb) print ce
$1 = (zend_class_entry *) 0x0

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

Reply via email to