- Reflection:
. Fixed bug #77772 (ReflectionClass::getMethods(null) doesn't work). (Nikita)
+ . Fixed bug #77882 (Different behavior: always calls destructor). (Nikita)
- Standard:
. Fixed bug #77680 (recursive mkdir on ftp stream wrapper is incorrect).
for (i = 0; i < num_args; i++) {
zval_ptr_dtor(¶ms[i]);
}
+
+ if (EG(exception)) {
+ zend_object_store_ctor_failed(Z_OBJ_P(return_value));
+ }
if (ret == FAILURE) {
php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
zval_dtor(return_value);
}
efree(params);
}
+
+ if (EG(exception)) {
+ zend_object_store_ctor_failed(Z_OBJ_P(return_value));
+ }
if (ret == FAILURE) {
zval_ptr_dtor(&retval);
php_error_docref(NULL, E_WARNING, "Invocation of %s's constructor failed", ZSTR_VAL(ce->name));
--- /dev/null
+--TEST--
+Bug #77882: Different behavior: always calls destructor
+--FILE--
+<?php
+
+class Test {
+ public function __construct() {
+ throw new Exception();
+ }
+
+ public function __destruct() {
+ echo "__destruct\n";
+ }
+}
+
+try {
+ new Test();
+} catch (Exception $e) {
+ echo "Exception\n";
+}
+try {
+ $ref = new ReflectionClass('Test');
+ $obj = $ref->newInstance();
+} catch (Exception $e) {
+ echo "Exception\n";
+}
+try {
+ $ref = new ReflectionClass('Test');
+ $obj = $ref->newInstanceArgs([]);
+} catch (Exception $e) {
+ echo "Exception\n";
+}
+
+?>
+--EXPECT--
+Exception
+Exception
+Exception