ID:               32852
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cox at idecnet dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: Linux
 PHP Version:      5.0.4
 New Comment:

If you configure with --enable-debug (rm config.cache && ./configure +
your options + --enable-debug && make clean && make) does it still
crash? Are you sure you ARE using the latest CVS? (the snapshots might
not be updated again..)



Previous Comments:
------------------------------------------------------------------------

[2005-04-27 23:25:44] [EMAIL PROTECTED]

Still works fine here.
Both with HEAD and 5.0.x.

------------------------------------------------------------------------

[2005-04-27 16:52:39] cox at idecnet dot com

Versions and compile options for the two that crashes for me. In case
it says something for you, if I remove the __destructor() function the
code works good (also you see in the output this function is being
called twice).

5.0.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PHP 5.0.4 (cli) (built: Apr 27 2005 11:48:13)
Configure Command =>  './configure' '--prefix=/usr'
'--with-config-file-path=/etc/php5' '--with-xml' '--with-zlib'
'--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir'
'--with-png-dir' '--with-jpeg-dir' '--disable-pear' '--with-mysql=/usr'
'--with-imap=/usr/include/imap' '--with-imap-ssl' '--with-kerberos'
'--with-gettext' '--enable-ftp' '--with-dom' '--with-mhash'
'--with-mcrypt' '--enable-cli' '--enable-sockets' '--enable-sigchild'
'--enable-pcntl' '--enable-shmop' '--enable-posix' '--enable-bcmath'
'--with-xmlrpc' '--with-mime-magic' '--disable-cgi'

5.0.5 Snapshot Stable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PHP 5.0.5-dev (cli) (built: Apr 27 2005 13:47:32) (DEBUG)
Configure Command =>  './configure' '--prefix=/usr'
'--with-config-file-path=/etc/php5' '--with-xml' '--with-zlib'
'--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir'
'--with-png-dir' '--with-jpeg-dir' '--disable-pear' '--with-mysql=/usr'
'--with-imap=/usr/include/imap' '--with-imap-ssl' '--with-kerberos'
'--with-gettext' '--enable-ftp' '--with-dom' '--with-mhash'
'--with-mcrypt' '--enable-cli' '--enable-sockets' '--enable-sigchild'
'--enable-pcntl' '--enable-shmop' '--enable-posix' '--enable-bcmath'
'--with-xmlrpc' '--with-mime-magic' '--disable-cgi' '--enable-debug'

------------------------------------------------------------------------

[2005-04-27 14:41:26] [EMAIL PROTECTED]

For some reason it doesn't crash for me..did you use --enable-debug ?


------------------------------------------------------------------------

[2005-04-27 14:10:28] cox at idecnet dot com

I'm not very expert on gdb usage. Please tell me if you need extra
info.

$ gdb /usr/bin/php5.0.5dev core.31085
GNU gdb 6.0-2mdk (Mandrake Linux)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i586-mandrake-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
 
Core was generated by `/usr/bin/php5.0.5dev test.php'.
Program terminated with signal 11, Segmentation fault.
 
warning: current_sos: Can't read pathname for load map: Input/output
error
 
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /usr/lib/libexpat.so.0...done.
Loaded symbols for /usr/lib/libexpat.so.0
Reading symbols from /usr/lib/libmysqlclient.so.12...done.
Loaded symbols for /usr/lib/libmysqlclient.so.12
Reading symbols from /lib/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib/tls/libm.so.6...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /usr/lib/libmhash.so.2...done.
Loaded symbols for /usr/lib/libmhash.so.2
Reading symbols from /usr/lib/libmcrypt.so.4...done.
Loaded symbols for /usr/lib/libmcrypt.so.4
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /usr/lib/libltdl.so.3...done.
Loaded symbols for /usr/lib/libltdl.so.3
Reading symbols from /lib/libpam.so.0...done.
Loaded symbols for /lib/libpam.so.0
Reading symbols from /usr/lib/libfreetype.so.6...done.
Loaded symbols for /usr/lib/libfreetype.so.6
Reading symbols from /usr/lib/libpng.so.3...done.
Loaded symbols for /usr/lib/libpng.so.3
Reading symbols from /usr/lib/libjpeg.so.62...done.
Loaded symbols for /usr/lib/libjpeg.so.62
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /usr/lib/libgssapi_krb5.so.2...done.
Loaded symbols for /usr/lib/libgssapi_krb5.so.2
Reading symbols from /usr/lib/libkrb5.so.3...done.
Loaded symbols for /usr/lib/libkrb5.so.3
Reading symbols from /usr/lib/libk5crypto.so.3...done.
Loaded symbols for /usr/lib/libk5crypto.so.3
Reading symbols from /lib/libcom_err.so.2...done.
Loaded symbols for /lib/libcom_err.so.2
Reading symbols from /usr/lib/libssl.so.0.9.7...done.
Loaded symbols for /usr/lib/libssl.so.0.9.7
Reading symbols from /usr/lib/libcrypto.so.0.9.7...done.
Loaded symbols for /usr/lib/libcrypto.so.0.9.7
Reading symbols from /usr/lib/libxml2.so.2...done.
Loaded symbols for /usr/lib/libxml2.so.2
Reading symbols from /lib/tls/libpthread.so.0...done.
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  0x08234e5a in zend_get_class_entry (zobject=0x844556c)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_API.c:204
204             if (Z_OBJ_HT_P(zobject)->get_class_entry) {
(gdb) bt
#0  0x08234e5a in zend_get_class_entry (zobject=0x844556c)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_API.c:204
#1  0x0825c021 in zend_assign_to_variable (result=0x845cefc,
op1=0x845cf10,
    op2=0x845cf24, value=0x844556c, type=4, Ts=0xbfffcfb0)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:599
#2  0x0825c48f in zend_assign_handler (execute_data=0xbfffd0d0,
    opline=0x845cef8, op_array=0x845b884)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:2267
#3  0x082587a6 in execute (op_array=0x845b884)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:1411
#4  0x0825d759 in zend_do_fcall_common_helper
(execute_data=0xbfffd1f0,
    opline=0x8459b10, op_array=0x84557f4)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:2761
#5  0x0825dd20 in zend_do_fcall_by_name_handler
(execute_data=0xbfffd1f0,
    opline=0x8459b10, op_array=0x84557f4)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:2846
#6  0x082587a6 in execute (op_array=0x84557f4)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:1411
#7  0x082346fa in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/src/php5-STABLE-200504271035/Zend/zend.c:1076
#8  0x081f3e9f in php_execute_script (primary_file=0xbffff600)
    at /usr/src/php5-STABLE-200504271035/main/main.c:1638
#9  0x08264ebf in main (argc=2, argv=0xbffff6c4)
    at /usr/src/php5-STABLE-200504271035/sapi/cli/php_cli.c:946
(gdb) frame 3
#3  0x082587a6 in execute (op_array=0x845b884)
    at /usr/src/php5-STABLE-200504271035/Zend/zend_execute.c:1411
1411                    if (EX(opline)->handler(&execute_data,
EX(opline), op_array TSRMLS_CC)) {
(gdb) print (char
*)(executor_globals.function_state_ptr->function)->common.function_name
$1 = 0x845b76c "singleton"
(gdb) print (char *)executor_globals.active_op_array->function_name
$2 = 0x845b76c "singleton"

------------------------------------------------------------------------

[2005-04-27 12:44:58] cox at idecnet dot com

Description:
------------
Crash with singleton() and __destruct(), see below.

Tomas V.V.Cox

Reproduce code:
---------------
<?php
class crashme {
    private static $instance = null;

    public function __construct() {
        self::$instance = $this;
    }

    public function __destruct() {
        echo "i'm called\n";
    }

    public static function singleton() {
        if (!isset(self::$instance)) {
            self::$instance = new crashme();
        }
        return self::$instance;
    }
}

crashme::singleton();
?>

Expected result:
----------------
i'm called

Actual result:
--------------
i'm called
i'm called
Segmentation fault (core dumped)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32852&edit=1

Reply via email to