summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-01-17 11:38:00 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-01-17 11:38:10 +0100
commit384dfe331b9431ee7b614412aea5cf887469e8ff (patch)
tree178df724142b4632df9e9ad33bd035b13e08161b /ext
parent4d24f5a49453fa1449f85e16548ceeb689edb0f6 (diff)
parent07bda97e765407bac9c37c9d4feb6aebb23434bd (diff)
downloadphp-git-384dfe331b9431ee7b614412aea5cf887469e8ff.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fixed bug #79115
Diffstat (limited to 'ext')
-rw-r--r--ext/reflection/php_reflection.c2
-rw-r--r--ext/reflection/tests/bug79115.phpt16
2 files changed, 18 insertions, 0 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 386130a307..5af48c4978 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4528,6 +4528,8 @@ ZEND_METHOD(reflection_class, isCloneable)
if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) {
return;
}
+ /* We're not calling the constructor, so don't call the destructor either. */
+ zend_object_store_ctor_failed(Z_OBJ(obj));
RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL);
zval_ptr_dtor(&obj);
}
diff --git a/ext/reflection/tests/bug79115.phpt b/ext/reflection/tests/bug79115.phpt
new file mode 100644
index 0000000000..b8ba6f1d7f
--- /dev/null
+++ b/ext/reflection/tests/bug79115.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #79115: ReflectionClass::isCloneable call reflected class __destruct
+--FILE--
+<?php
+
+class A {
+ function __construct() { echo __FUNCTION__ . "\n"; }
+ function __destruct() { echo __FUNCTION__ . "\n"; }
+}
+
+$c = new ReflectionClass('A');
+var_dump($c->isCloneable());
+
+?>
+--EXPECT--
+bool(true)