mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload
results in segfault).
This commit is contained in:
parent
cf45beedb5
commit
c6cb00fe59
2
NEWS
2
NEWS
@ -2,6 +2,8 @@ PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2004, PHP 5 RC 1
|
||||
- Preserve class name casing for userspace classes. (Marcus)
|
||||
- Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload
|
||||
results in segfault). (Marcus)
|
||||
- Fixed bug #26695 (Reflection API does not recognize mixed-case class hints).
|
||||
(Marcus)
|
||||
- Fixed bug #26690 (make xsltProcessor->transformToUri use streams wrappers).
|
||||
|
24
Zend/tests/bug26697.phpt
Executable file
24
Zend/tests/bug26697.phpt
Executable file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault)
|
||||
--SKIPIF--
|
||||
<?php if (function_exists('__autoload')) die('skip __autoload() declared in auto_prepend_file');?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function __autoload($name)
|
||||
{
|
||||
echo __METHOD__ . "($name)\n";
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
echo __METHOD__ . "($name), done\n";
|
||||
}
|
||||
|
||||
var_dump(class_exists('NotExistingClass'));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
__autoload(NotExistingClass)
|
||||
bool(false)
|
||||
__autoload(NotExistingClass), done
|
||||
bool(false)
|
||||
===DONE===
|
@ -472,6 +472,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
|
||||
EG(user_error_handler) = NULL;
|
||||
EG(user_exception_handler) = NULL;
|
||||
EG(in_execution) = 0;
|
||||
EG(in_autoload) = 0;
|
||||
EG(current_execute_data) = NULL;
|
||||
}
|
||||
|
||||
|
@ -138,6 +138,7 @@ void init_executor(TSRMLS_D)
|
||||
EG(class_table) = CG(class_table);
|
||||
|
||||
EG(in_execution) = 0;
|
||||
EG(in_autoload) = 0;
|
||||
|
||||
zend_ptr_stack_init(&EG(argument_stack));
|
||||
|
||||
@ -791,6 +792,12 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (EG(in_autoload)) {
|
||||
free_alloca(lc_name);
|
||||
return FAILURE;
|
||||
}
|
||||
EG(in_autoload) = 1;
|
||||
|
||||
ZVAL_STRINGL(&autoload_function, "__autoload", sizeof("__autoload")-1, 0);
|
||||
|
||||
INIT_PZVAL(class_name_ptr);
|
||||
@ -802,6 +809,8 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
|
||||
EG(exception) = NULL;
|
||||
retval = call_user_function_ex(EG(function_table), NULL, &autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
|
||||
|
||||
EG(in_autoload) = 0;
|
||||
|
||||
if (retval == FAILURE) {
|
||||
EG(exception) = exception;
|
||||
free_alloca(lc_name);
|
||||
|
@ -191,6 +191,7 @@ struct _zend_executor_globals {
|
||||
int ticks_count;
|
||||
|
||||
zend_bool in_execution;
|
||||
zend_bool in_autoload;
|
||||
zend_bool bailout_set;
|
||||
zend_bool full_tables_cleanup;
|
||||
zend_bool implicit_clone;
|
||||
|
Loading…
Reference in New Issue
Block a user