cvs: ZendEngine2(PHP_5_3) / zend_execute.c /tests bug48004.phpt php-src NEWS

"Dmitry Stogov" <[email protected]> Tue, 21 Apr 2009 08:12:07 -0000
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1240301527@cvsserver>
dmitry		Tue Apr 21 08:12:07 2009 UTC

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

  Modified files:              
    /php-src	NEWS 
    /ZendEngine2	zend_execute.c 
  Log:
  Fixed bug #48004 (Error handler prevents creation of default object)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.565&r2=1.2027.2.547.2.965.2.566&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.565 php-src/NEWS:1.2027.2.547.2.965.2.566
--- php-src/NEWS:1.2027.2.547.2.965.2.565	Mon Apr 20 14:20:20 2009
+++ php-src/NEWS	Tue Apr 21 08:12:07 2009
@@ -13,6 +13,8 @@
   context. (Dmitry)
 
 - Fixed bug #48023 (spl_autoload_register didn't store closures). (Etienne)
+- Fixed bug #48004 (Error handler prevents creation of default object).
+  (Dmitry)
 - Fixed bug #47880 (crashes in call_user_func_array()). (Dmitry)
 - Fixed bug #47856 (stristr() converts needle to lower-case). (Ilia)
 - Fixed bug #47851 (is_callable throws fatal error). (Dmitry)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.716.2.12.2.24.2.41&r2=1.716.2.12.2.24.2.42&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.41 ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.42
--- ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.41	Wed Mar 18 14:15:28 2009
+++ ZendEngine2/zend_execute.c	Tue Apr 21 08:12:07 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.41 2009/03/18 14:15:28 dmitry Exp $ */
+/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.42 2009/04/21 08:12:07 dmitry Exp $ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -518,13 +518,13 @@
 static inline void zend_assign_to_object(znode *result, zval **object_ptr, zval *property_name, znode *value_op, const temp_variable *Ts, int opcode TSRMLS_DC)
 
 {
-	zval *object;
+	zval *object = *object_ptr;
 	zend_free_op free_value;
 	zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
 	zval **retval = &T(result->u.var).var.ptr;
 
-	if (Z_TYPE_P(*object_ptr) != IS_OBJECT) {
-		if (*object_ptr == EG(error_zval_ptr)) {
+	if (Z_TYPE_P(object) != IS_OBJECT) {
+		if (object == EG(error_zval_ptr)) {
 			if (!RETURN_VALUE_UNUSED(result)) {
 				*retval = EG(uninitialized_zval_ptr);
 				PZVAL_LOCK(*retval);
@@ -532,13 +532,14 @@
 			FREE_OP(free_value);
 			return;
 		}
-		if (Z_TYPE_PP(object_ptr) == IS_NULL ||
-		    (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0) ||
-		    (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)) {
-			zend_error(E_STRICT, "Creating default object from empty value");
+		if (Z_TYPE_P(object) == IS_NULL ||
+		    (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
+		    (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
 			SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
-			zval_dtor(*object_ptr);
-			object_init(*object_ptr);
+			zval_dtor(object);
+			object = *object_ptr;
+			object_init(object);
+			zend_error(E_STRICT, "Creating default object from empty value");
 		} else {
 			zend_error(E_WARNING, "Attempt to assign property of non-object");
 			if (!RETURN_VALUE_UNUSED(result)) {
@@ -551,7 +552,6 @@
 	}
 	
 	/* here we are sure we are dealing with an object */
-	object = *object_ptr;
 
 	/* separate our value if necessary */
 	if (value_op->op_type == IS_TMP_VAR) {

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



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php