cvs: ZendEngine2(PHP_5_3) / zend_vm_def.h zend_vm_execute.h /tests bug47771.phpt php-src NEWS

[email protected] ("Dmitry Stogov") Thu, 26 Mar 2009 10:17:34 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1238062654@cvsserver>
dmitry		Thu Mar 26 10:17:34 2009 UTC

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

  Modified files:              
    /php-src	NEWS 
    /ZendEngine2	zend_vm_def.h zend_vm_execute.h 
  Log:
  Fixed bug #47771 (Exception during object construction from arg call calls object's destructor)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.534&r2=1.2027.2.547.2.965.2.535&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.534 php-src/NEWS:1.2027.2.547.2.965.2.535
--- php-src/NEWS:1.2027.2.547.2.965.2.534	Wed Mar 25 22:52:30 2009
+++ php-src/NEWS	Thu Mar 26 10:17:27 2009
@@ -3,6 +3,8 @@
 ?? ??? 200?, PHP 5.3.0 RC 2
 - Fixed bug #47779 (Wrong value for SIG_UNBLOCK and SIG_SETMASK constants).
   (Matteo)
+- Fixed bug #47771 (Exception during object construction from arg call calls
+  object's destructor). (Dmitry)
 - Fixed bug #47699 (autoload and late static binding). (Dmitry)
 - Fixed bug #47038 (Memory leak in include). (Dmitry)
 - Fixed bug #44409 (PDO::FETCH_SERIALIZE calls __construct()). (Matteo)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.88&r2=1.59.2.29.2.48.2.89&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.88 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.89
--- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.88	Wed Mar 18 18:49:27 2009
+++ ZendEngine2/zend_vm_def.h	Thu Mar 26 10:17:27 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.88 2009/03/18 18:49:27 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.89 2009/03/26 10:17:27 dmitry Exp $ */
 
 /* If you change this file, please regenerate the zend_vm_execute.h and
  * zend_vm_opcodes.h files by running:
@@ -4286,8 +4286,13 @@
 	while (EX(fbc)) {
 		EX(called_scope) = (zend_class_entry*)zend_ptr_stack_pop(&EG(arg_types_stack));
 		if (EX(object)) {
-			if (IS_CTOR_USED(EX(called_scope))) {
-				Z_DELREF_P(EX(object));
+			if (IS_CTOR_CALL(EX(called_scope))) {
+				if (IS_CTOR_USED(EX(called_scope))) {
+					Z_DELREF_P(EX(object));
+				}
+				if (Z_REFCOUNT_P(EX(object)) == 1) {
+					zend_object_store_ctor_failed(EX(object) TSRMLS_CC);
+				}
 			}
 			zval_ptr_dtor(&EX(object));
 		}
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.88&r2=1.62.2.30.2.49.2.89&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.88 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.89
--- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.88	Wed Mar 18 18:49:27 2009
+++ ZendEngine2/zend_vm_execute.h	Thu Mar 26 10:17:27 2009
@@ -625,8 +625,13 @@
 	while (EX(fbc)) {
 		EX(called_scope) = (zend_class_entry*)zend_ptr_stack_pop(&EG(arg_types_stack));
 		if (EX(object)) {
-			if (IS_CTOR_USED(EX(called_scope))) {
-				Z_DELREF_P(EX(object));
+			if (IS_CTOR_CALL(EX(called_scope))) {
+				if (IS_CTOR_USED(EX(called_scope))) {
+					Z_DELREF_P(EX(object));
+				}
+				if (Z_REFCOUNT_P(EX(object)) == 1) {
+					zend_object_store_ctor_failed(EX(object) TSRMLS_CC);
+				}
 			}
 			zval_ptr_dtor(&EX(object));
 		}

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