cvs: ZendEngine2(PHP_5_3) / zend_execute_API.c /tests bug47320.phpt php-src NEWS php-src/main main.c

[email protected] ("Dmitry Stogov") Mon, 09 Feb 2009 09:20:35 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1234171235@cvsserver>
dmitry		Mon Feb  9 09:20:35 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /ZendEngine2/tests	bug47320.phpt 

  Modified files:              
    /php-src	NEWS 
    /php-src/main	main.c 
    /ZendEngine2	zend_execute_API.c 
  Log:
  Fixed bug #47320 ($php_errormsg out of scope in functions)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.487&r2=1.2027.2.547.2.965.2.488&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.487 php-src/NEWS:1.2027.2.547.2.965.2.488
--- php-src/NEWS:1.2027.2.547.2.965.2.487	Thu Feb  5 23:59:17 2009
+++ php-src/NEWS	Mon Feb  9 09:20:34 2009
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2009, PHP 5.3.0 Beta 2
+- Fixed bug #47320 ($php_errormsg out of scope in functions). (Dmitry)
 - Fixed bug #47265 (generating phar.phar failes because of safe_mode). (Greg)
 - Fixed bug #47229 (preg_quote() should escape the '-' char). (Nuno)
 - Fixed bug #47085 (rename() returns true even if the file in PHAR does not exist). (Greg)
http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.45&r2=1.640.2.23.2.57.2.46&diff_format=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.640.2.23.2.57.2.45 php-src/main/main.c:1.640.2.23.2.57.2.46
--- php-src/main/main.c:1.640.2.23.2.57.2.45	Sat Jan 17 01:12:36 2009
+++ php-src/main/main.c	Mon Feb  9 09:20:34 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.640.2.23.2.57.2.45 2009/01/17 01:12:36 stas Exp $ */
+/* $Id: main.c,v 1.640.2.23.2.57.2.46 2009/02/09 09:20:34 dmitry Exp $ */
 
 /* {{{ includes
  */
@@ -750,12 +750,17 @@
 		efree(docref_buf);
 	}
 
-	if (PG(track_errors) && module_initialized && EG(active_symbol_table) && 
+	if (PG(track_errors) && module_initialized && 
 			(!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) {
-		zval *tmp;
-		ALLOC_INIT_ZVAL(tmp);
-		ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
-		zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *), NULL);
+		if (!EG(active_symbol_table)) {
+			zend_rebuild_symbol_table(TSRMLS_C);
+		}
+		if (EG(active_symbol_table)) {
+			zval *tmp;
+			ALLOC_INIT_ZVAL(tmp);
+			ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
+			zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) &tmp, sizeof(zval *), NULL);
+		}
 	}
 	efree(buffer);
 
@@ -1033,11 +1038,16 @@
 		return;
 	}
 
-	if (PG(track_errors) && module_initialized && EG(active_symbol_table)) {
-		zval *tmp;
-		ALLOC_INIT_ZVAL(tmp);
-		ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
-		zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL);
+	if (PG(track_errors) && module_initialized) {
+		if (!EG(active_symbol_table)) {
+			zend_rebuild_symbol_table(TSRMLS_C);
+		}
+		if (EG(active_symbol_table)) {
+			zval *tmp;
+			ALLOC_INIT_ZVAL(tmp);
+			ZVAL_STRINGL(tmp, buffer, buffer_len, 1);
+			zend_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(zval *), NULL);
+		}
 	}
 
 	efree(buffer);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.69&r2=1.331.2.20.2.24.2.70&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.69 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.70
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.69	Fri Jan  2 13:14:49 2009
+++ ZendEngine2/zend_execute_API.c	Mon Feb  9 09:20:35 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.69 2009/01/02 13:14:49 helly Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.70 2009/02/09 09:20:35 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -1631,15 +1631,15 @@
 			return;
 		}
 
-		if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
-			/*printf("Cache hit!  Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
-			EG(active_symbol_table) = *(EG(symtable_cache_ptr)--);
-		} else {
-			ALLOC_HASHTABLE(EG(active_symbol_table));
-			zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
-			/*printf("Cache miss!  Initialized %x\n", EG(active_symbol_table));*/
-		}
 		if (ex && ex->op_array) {
+			if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
+				/*printf("Cache hit!  Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
+				EG(active_symbol_table) = *(EG(symtable_cache_ptr)--);
+			} else {
+				ALLOC_HASHTABLE(EG(active_symbol_table));
+				zend_hash_init(EG(active_symbol_table), 0, NULL, ZVAL_PTR_DTOR, 0);
+				/*printf("Cache miss!  Initialized %x\n", EG(active_symbol_table));*/
+			}
 			ex->symbol_table = EG(active_symbol_table);
 
 			if (ex->op_array->this_var != -1 &&

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug47320.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug47320.phpt
+++ ZendEngine2/tests/bug47320.phpt