Edit report at https://bugs.php.net/bug.php?id=63741&edit=1

 ID:                 63741
 User updated by:    bobwei9 at hotmail dot com
 Reported by:        bobwei9 at hotmail dot com
 Summary:            Crash when autoloading from spl
 Status:             Open
 Type:               Bug
 Package:            SPL related
 Operating System:   Mac OS X Mountain Lion
 PHP Version:        master-Git-2012-12-11 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

I get everytime the same backtrace... Is it perhaps OS-dependent? The phpinfo() 
is here: http://bobweinand.no-ip.org/phpinfo.php
instance_ce seems wrong: for example instance_ce->num_interfaces: it had a 
value of 2^32-1

#0  0x00000001008fb936 in instanceof_function_ex 
(instance_ce=0x5a5a5a5a00000000, ce=0x10223d8f0, interfaces_only=0 '\0', 
tsrm_ls=0x101710f20) at zend_operators.c:1720
#1  0x00000001008fb9e5 in instanceof_function (instance_ce=0x5a5a5a5a00000000, 
ce=0x10223d8f0, tsrm_ls=0x101710f20) at zend_operators.c:1740
#2  0x0000000100934457 in zend_call_method (object_pp=0x0, obj_ce=0x10223d8f0, 
fn_proxy=0x10223f170, function_name=0x10223c418 "autoloader::autoload", 
function_name_len=21, retval_ptr_ptr=0x7fff5fbfd628, param_count=1, 
arg1=0x10223ada0, arg2=0x0, tsrm_ls=0x101710f20) at zend_interfaces.c:89
#3  0x00000001005a6128 in zif_spl_autoload_call (ht=1, 
return_value=0x102237d18, return_value_ptr=0x7fff5fbfded8, this_ptr=0x0, 
return_value_used=1, tsrm_ls=0x101710f20) at php_spl.c:436
#4  0x00000001008e7023 in zend_call_function (fci=0x7fff5fbfde78, 
fci_cache=0x7fff5fbfde50, tsrm_ls=0x101710f20) at zend_execute_API.c:979
#5  0x00000001008e814a in zend_lookup_class_ex (name=0x10223dea8 "ClassToLoad", 
name_length=11, key=0x10223e008, use_autoload=1, ce=0x7fff5fbfdf70, 
tsrm_ls=0x101710f20) at zend_execute_API.c:1129
#6  0x00000001008e9f2e in zend_fetch_class_by_name (class_name=0x10223dea8 
"ClassToLoad", class_name_len=11, key=0x10223e008, fetch_type=0, 
tsrm_ls=0x101710f20) at zend_execute_API.c:1609
#7  0x0000000100978c23 in ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER 
(execute_data=0x102202358, tsrm_ls=0x101710f20) at zend_vm_execute.h:3550
#8  0x0000000100963fe2 in execute_ex (execute_data=0x102202358, 
tsrm_ls=0x101710f20) at zend_vm_execute.h:356
#9  0x00000001009650fc in zend_execute (op_array=0x102239d98, 
tsrm_ls=0x101710f20) at zend_vm_execute.h:381
#10 0x0000000100905463 in zend_execute_scripts (type=8, tsrm_ls=0x101710f20, 
retval=0x0, file_count=3) at zend.c:1309
#11 0x00000001008215ac in php_execute_script (primary_file=0x7fff5fbff728, 
tsrm_ls=0x101710f20) at main.c:2468
#12 0x0000000100b2e98f in do_cli (argc=2, argv=0x7fff5fbffa18, 
tsrm_ls=0x101710f20) at php_cli.c:988
#13 0x0000000100b30a3e in main (argc=2, argv=0x7fff5fbffa18) at php_cli.c:1364


Previous Comments:
------------------------------------------------------------------------
[2012-12-13 02:49:53] larue...@php.net

unfortunately, I can not reproduce it. instead I got a FATAL ERROR:

can not redeclare function main ....

------------------------------------------------------------------------
[2012-12-12 18:33:13] bobwei9 at hotmail dot com

<?php

if (isset($autoload))
{
        class ClassToLoad
        {
                static function func ()
                {
                        print "OK!\n";
                }
        }
        return;
}

class autoloader
{
        static function autoload($classname)
        {
                print "autoloaded\n";
                $autoload = true;
                include __FILE__;
        }
}

spl_autoload_register(["autoloader", "autoload"]);

function main()
{
        ClassToLoad::func();
}

main();


=>

Segmentation fault: 11 (core dumped)

Segfault if called from a function (≠ in a class)

Can you reproduce this? Or do you need more info?

------------------------------------------------------------------------
[2012-12-12 10:16:14] larue...@php.net

yes, it's needed :), thanks

------------------------------------------------------------------------
[2012-12-12 09:15:58] bobwei9 at hotmail dot com

In the base directory of the install. An autoloader defined previously with 
spl_autoload_register is called in the GlobalFunctions.php (see the zbacktrace 
in 
the opening post) and then crashes.
In the evening I'll try to create a smaller reproduce script if needed.

------------------------------------------------------------------------
[2012-12-12 04:15:47] larue...@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 the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

where the index.php is?

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=63741


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

Reply via email to