cvs: ZendEngine2 / zend.c zend_execute_API.c zend_globals.h /tests bug26697.phpt php-src NEWS

From: Date: Tue, 23 Dec 2003 10:45:11 +0000
Subject: cvs: ZendEngine2 / zend.c zend_execute_API.c zend_globals.h /tests bug26697.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-2152@lists.php.net to get a copy of this message
helly Tue Dec 23 05:45:11 2003 EDT Added files: /ZendEngine2/tests bug26697.phpt Modified files: /php-src NEWS /ZendEngine2 zend.c zend_execute_API.c zend_globals.h Log: Fixed bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault). Index: php-src/NEWS diff -u php-src/NEWS:1.1555 php-src/NEWS:1.1556 --- php-src/NEWS:1.1555 Tue Dec 23 01:28:12 2003 +++ php-src/NEWS Tue Dec 23 05:45:08 2003 @@ -2,6 +2,8 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 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). Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.260 ZendEngine2/zend.c:1.261 --- ZendEngine2/zend.c:1.260 Fri Dec 19 09:08:22 2003 +++ ZendEngine2/zend.c Tue Dec 23 05:45:09 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.260 2003/12/19 14:08:22 dmitry Exp $ */ +/* $Id: zend.c,v 1.261 2003/12/23 10:45:09 helly Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -472,6 +472,7 @@ EG(user_error_handler) = NULL; EG(user_exception_handler) = NULL; EG(in_execution) = 0; + EG(in_autoload) = 0; EG(current_execute_data) = NULL; } Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.246 ZendEngine2/zend_execute_API.c:1.247 --- ZendEngine2/zend_execute_API.c:1.246 Wed Dec 17 10:08:13 2003 +++ ZendEngine2/zend_execute_API.c Tue Dec 23 05:45:09 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.246 2003/12/17 15:08:13 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.247 2003/12/23 10:45:09 helly Exp $ */ #include <stdio.h> #include <signal.h> @@ -138,6 +138,7 @@ 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 @@ 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 @@ 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); Index: ZendEngine2/zend_globals.h diff -u ZendEngine2/zend_globals.h:1.128 ZendEngine2/zend_globals.h:1.129 --- ZendEngine2/zend_globals.h:1.128 Mon Aug 11 01:24:41 2003 +++ ZendEngine2/zend_globals.h Tue Dec 23 05:45:09 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.128 2003/08/11 05:24:41 fujimoto Exp $ */ +/* $Id: zend_globals.h,v 1.129 2003/12/23 10:45:09 helly Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -191,6 +191,7 @@ int ticks_count; zend_bool in_execution; + zend_bool in_autoload; zend_bool bailout_set; zend_bool full_tables_cleanup; zend_bool implicit_clone; Index: ZendEngine2/tests/bug26697.phpt +++ ZendEngine2/tests/bug26697.phpt --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===

« previous php.zend-engine.cvs (#2152) next »