Skip to content

Commit 384dfe3

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fixed bug #79115
2 parents 4d24f5a + 07bda97 commit 384dfe3

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ PHP NEWS
1313
. Fixed bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH).
1414
(cmb)
1515

16+
- Reflection:
17+
. Fixed bug #79115 (ReflectionClass::isCloneable call reflected class
18+
__destruct). (Nikita)
19+
1620
23 Jan 2020, PHP 7.4.2
1721

1822
- Core:

ext/reflection/php_reflection.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4528,6 +4528,8 @@ ZEND_METHOD(reflection_class, isCloneable)
45284528
if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) {
45294529
return;
45304530
}
4531+
/* We're not calling the constructor, so don't call the destructor either. */
4532+
zend_object_store_ctor_failed(Z_OBJ(obj));
45314533
RETVAL_BOOL(Z_OBJ_HANDLER(obj, clone_obj) != NULL);
45324534
zval_ptr_dtor(&obj);
45334535
}

ext/reflection/tests/bug79115.phpt

Lines changed: 16 additions & 0 deletions
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)