Skip to content

Commit ad3ddf4

Browse files
committed
Fixed bug #78644
Make sure the initialize the result of FETCH_OBJ_UNSET operations. I'm using a NULL value rather than ERROR here, because the latter no longer exists in master.
1 parent d1de177 commit ad3ddf4

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ PHP NEWS
88
. Fixed bug #78620 (Out of memory error). (cmb, Nikita)
99
. Fixed bug #78632 (method_exists() in php74 works differently from php73 in
1010
checking priv. methods). (Nikita)
11+
. Fixed bug #78644 (SEGFAULT in ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER).
12+
(Nikita)
1113

1214
- Iconv:
1315
. Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,

Zend/tests/bug78644.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #78644: SEGFAULT in ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER
3+
--FILE--
4+
<?php
5+
6+
$a = new stdClass;
7+
unset($a->b->c->d);
8+
unset($a->b->c['d']);
9+
var_dump($a);
10+
11+
?>
12+
--EXPECT--
13+
object(stdClass)#1 (1) {
14+
["b"]=>
15+
NULL
16+
}

Zend/zend_execute.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
27652765

27662766
/* this should modify object only if it's empty */
27672767
if (type == BP_VAR_UNSET) {
2768+
ZVAL_NULL(result);
27682769
return;
27692770
}
27702771

0 commit comments

Comments
 (0)