diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-17 11:37:35 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-17 11:37:35 +0100 |
commit | 07bda97e765407bac9c37c9d4feb6aebb23434bd (patch) | |
tree | 580b0fad80e29f7d39bae827f5631dcb328231fe | |
parent | 018251a7c492916a6fa2c0e9a5e7adaba14bd614 (diff) | |
download | php-git-07bda97e765407bac9c37c9d4feb6aebb23434bd.tar.gz |
Fixed bug #79115
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/reflection/php_reflection.c | 2 | ||||
-rw-r--r-- | ext/reflection/tests/bug79115.phpt | 16 |
3 files changed, 22 insertions, 0 deletions
@@ -14,6 +14,10 @@ PHP NEWS . Fixed bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH). (cmb) +- Reflection: + . Fixed bug #79115 (ReflectionClass::isCloneable call reflected class + __destruct). (Nikita) + 23 Jan 2020, PHP 7.3.14 - Core diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index ac623e1c05..3fa4533e4e 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4588,6 +4588,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) |