mirror of
https://github.com/php/php-src.git
synced 2025-01-25 05:04:20 +08:00
fix #41026 (segfault when calling "self::method()" in shutdown functions)
This commit is contained in:
parent
65afdf097c
commit
b2e2994a6e
26
Zend/tests/bug41026.phpt
Normal file
26
Zend/tests/bug41026.phpt
Normal file
@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #41026 (segfault when calling "self::method()" in shutdown functions)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class try_class
|
||||
{
|
||||
static public function main ()
|
||||
{
|
||||
register_shutdown_function (array ("self", "on_shutdown"));
|
||||
}
|
||||
|
||||
static public function on_shutdown ()
|
||||
{
|
||||
printf ("CHECKPOINT\n"); /* never reached */
|
||||
}
|
||||
}
|
||||
|
||||
try_class::main ();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
||||
|
||||
Warning: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in Unknown on line 0
|
@ -2262,9 +2262,9 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
|
||||
}
|
||||
|
||||
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
|
||||
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
|
||||
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0 && EG(active_op_array)) {
|
||||
ce = EG(active_op_array)->scope;
|
||||
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
|
||||
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
|
||||
ce = EG(active_op_array)->scope->parent;
|
||||
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
|
||||
ce = *pce;
|
||||
|
Loading…
Reference in New Issue
Block a user