. Added PHP to SAPI error severity mapping for logs. (Martin Vobruba)
. Fixed bug #71911 (Unable to set --enable-debug on building extensions by
phpize on Windows). (Yuji Uchiyama)
+ . Fixed bug #29368 (The destructor is called when an exception is thrown from
+ the constructor). (Dmitry)
- COM:
. Fixed bug #72569 (DOTNET/COM array parameters broke in PHP7). (Anatol)
syslog error levels. This brings finer differentiation in the error logs
in contrary to the previous approach where all the errors are loggged with
the notice level only.
+ . Don't call destructors of incompletely constructed objects, even if they
+ are kept referenced. See bug #29368 and Zend/tests/bug29368_1.phpt.
- JSON:
. The serialize_precision is used instead of precision when encoding double
--- /dev/null
+--TEST--
+Bug #29368.1 (The destructor is called when an exception is thrown from the constructor).
+--FILE--
+<?php
+function throwme($arg)
+{
+ throw new Exception;
+}
+
+class foo {
+ function __construct() {
+ echo "Inside constructor\n";
+ throwme($this);
+ }
+
+ function __destruct() {
+ echo "Inside destructor\n";
+ }
+}
+
+try {
+ $bar = new foo;
+} catch(Exception $exc) {
+ echo "Caught exception!\n";
+}
+?>
+--EXPECT--
+Inside constructor
+Caught exception!
if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
if (UNEXPECTED(EG(exception) != NULL) && (ZEND_CALL_INFO(call) & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
}
if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
if (UNEXPECTED(EG(exception) != NULL) && (ZEND_CALL_INFO(call) & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
}
if (UNEXPECTED(EG(exception) != NULL) && (ZEND_CALL_INFO(call) & ZEND_CALL_CTOR)) {
#endif
GC_REFCOUNT(object)--;
- if (GC_REFCOUNT(object) == 1) {
- zend_object_store_ctor_failed(object);
- }
+ zend_object_store_ctor_failed(object);
}
OBJ_RELEASE(object);
}