Skip to content

Commit 117b18d

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #79115
2 parents 9ec1ee5 + 384dfe3 commit 117b18d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

ext/reflection/php_reflection.c

+2
Original file line numberDiff line numberDiff line change
@@ -4604,6 +4604,8 @@ ZEND_METHOD(reflection_class, isCloneable)
46044604
if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) {
46054605
return;
46064606
}
4607+
/* We're not calling the constructor, so don't call the destructor either. */
4608+
zend_object_store_ctor_failed(Z_OBJ(obj));
46074609
RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL);
46084610
zval_ptr_dtor(&obj);
46094611
}

ext/reflection/tests/bug79115.phpt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #79115: ReflectionClass::isCloneable call reflected class __destruct
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
function __construct() { echo __FUNCTION__ . "\n"; }
8+
function __destruct() { echo __FUNCTION__ . "\n"; }
9+
}
10+
11+
$c = new ReflectionClass('A');
12+
var_dump($c->isCloneable());
13+
14+
?>
15+
--EXPECT--
16+
bool(true)

0 commit comments

Comments
 (0)