com php-src: Merge branch 'PHP-7.2' into PHP-7.3: Zend/tests/gc _042.phpt Zend/zend_gc.c
| From: | Nikita Popov | Date: | Mon, 26 Aug 2019 15:52:37 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.2' into PHP-7.3: Zend/tests/gc _042.phpt Zend/zend_gc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108072@lists.php.net to get a copy of this message | ||
Commit: 461db524001fbcbd3344a08651f3a64c775967d6
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 26 Aug 2019 17:50:46 +0200
Parents: e4ecadcb626d00feb5df17d66a43cabc0b440560 589542f50cbaf2bfc88aea79092df9db54f75ac6
Branches: PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=461db524001fbcbd3344a08651f3a64c775967d6
Log:
Merge branch 'PHP-7.2' into PHP-7.3
Changed paths:
AM Zend/tests/gc_042.phpt
MM Zend/zend_gc.c
Diff:
diff --cc Zend/tests/gc_042.phpt
index 0000000,a7c40fe..c8dfc0e
mode 000000,100644..100644
--- a/Zend/tests/gc_042.phpt
+++ b/Zend/tests/gc_042.phpt
@@@ -1,0 -1,26 +1,28 @@@
+ --TEST--
+ Object properties HT may need to be removed from nested data
+ --FILE--
+ <?php
+
+ class Test {
+ public function __destruct() {
+ $GLOBALS['x'] = $this;
+ }
+ }
+
+ $t = new Test;
+ $t->x = new stdClass;
+ $t->x->t = $t;
+ $a = (array) $t->x;
+ unset($t, $a);
+ gc_collect_cycles();
+ var_dump($x);
+
-// TODO: The destructor *should* be running here, but doesn't.
-// This works in PHP >= 7.3 though.
-
+ ?>
---EXPECTF--
-Notice: Undefined variable: x in %s on line %d
-NULL
++--EXPECT--
++object(Test)#1 (1) {
++ ["x"]=>
++ object(stdClass)#2 (1) {
++ ["t"]=>
++ *RECURSION*
++ }
++}
diff --cc Zend/zend_gc.c
index b651015,1b6d53a..3a36a8c
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@@ -1400,6 -1007,10 +1400,10 @@@ tail_call
ref = Z_COUNTED_P(zv);
goto tail_call;
}
- if (GC_ADDRESS(GC_INFO(ht)) != 0 && GC_REF_GET_COLOR(ht) == GC_BLACK) {
++ if (GC_REF_ADDRESS(ht) != 0 && GC_REF_CHECK_COLOR(ht, GC_BLACK)) {
+ GC_TRACE_REF(ht, "removing from buffer");
+ GC_REMOVE_FROM_BUFFER(ht);
+ }
} else {
return;
}