Edit report at https://bugs.php.net/bug.php?id=63741&edit=1
ID: 63741
Updated by: laruence@php.net
Reported by: bobwei9 at hotmail dot com
Summary: Crash when autoloading from spl
Status: Feedback
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:
oh, seems your are a zts build, then you have to find out executor_global first
it should be:
(((zend_executor_globals *) (*((void ***) tsrm_ls))[executor_globals_id-1])-
>called_scope)
Previous Comments:
------------------------------------------------------------------------
[2012-12-13 08:12:44] laruence@php.net
@bobwei9 hmm, seems EG(called_scope) was polluted somewhere, maybe you can break
at zend_execute , then watch executor_globals->called_scope, find the place where
it became 0x5a5a5a5a00000
that will be very helpful..
thanks
------------------------------------------------------------------------
[2012-12-13 06:36:22] bobwei9 at hotmail dot com
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
------------------------------------------------------------------------
[2012-12-13 02:49:53] laruence@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] laruence@php.net
yes, it's needed :), thanks
------------------------------------------------------------------------
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