Skip to content

Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots - #22013

Merged
arnaud-lb merged 3 commits into
php:PHP-8.4from
arnaud-lb:gh21999
Sep 21, 2026
Merged

arnaud-lb merged 3 commits into
php:PHP-8.4from
arnaud-lb:gh21999

Conversation

@arnaud-lb

Copy link
Copy Markdown
Member

Fixes GH-21999.

In the reproducer, a series of events causes a lazy object's properties ht to be a GC root [1]. The lazy object's get_gc() handler however doesn't return the properties ht in this case, but still exposes properties to the GC. This causes properties to be visited twice.

[1]: var_dump($obj) builds the object's properties ht, zend_compare_symbol_tables() adds it to GC roots.

@arnaud-lb arnaud-lb changed the title Fix GC inconsistency Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots May 11, 2026
@arnaud-lb
arnaud-lb changed the base branch from master to PHP-8.4 May 11, 2026 15:04
@arnaud-lb
arnaud-lb marked this pull request as ready for review May 12, 2026 08:45
* up/PHP-8.4: (338 commits)
  Fix phpGH-23693: JIT guard branches on stale flags across basic blocks
  Fix OSS-Fuzz #546798343: Heap-buffer-overflow in zend_delete_call_instructions with callable conversion
  Fix three Win32-only defects in proc_open descriptor handling
  Fix heap over-read in cli_get_prompt() for empty cli.prompt
  Fix phpGH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during request activation)
  Fix phpGH-23729: DOMXPath::__construct() use-after-free during an evaluation
  ext/zip: ZipArchive::close() use-after-free from a progress or cancel callback.
  ext/xsl: XSLTProcessor::importStylesheet() use-after-free during a transformation.
  ext/sockets: socket_select() silent set truncation on Windows.
  dom: fix attribute namespaces from foreign content in the HTML parser
  ext/sqlite3: reject close() from inside a callback
  ext/pdo: Bound-check column index in getColumnMeta()
  Fix phpGH-23365: DOMNode::insertBefore() drops the node used as its own reference
  Revert Zend: Fix iterator relocation at the current element during rehash in 8.4 and 8.5
  Updated to version 2026.4 (2026d)
  [skip ci] lexbor: Reference upstream commits as lexbor/lexbor@<sha> in NEWS
  lexbor: Merge upstream memory safety fixes 8a14bc0 and f67ce4b
  Avoid closing libxml output encoder twice (php#23678)
  ext/intl: Preserve PHP-side state when cloning formatters
  Fix phpGH-23106: mb_strpos() overreads truncated UTF-8 haystacks (php#23107)
  ...
@arnaud-lb
arnaud-lb merged commit be5e564 into php:PHP-8.4 Sep 21, 2026
2 checks passed
@arnaud-lb
arnaud-lb deleted the gh21999 branch September 21, 2026 09:10
arnaud-lb added a commit that referenced this pull request Sep 21, 2026
* PHP-8.5:
  Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots (#22013)
LamentXU123 pushed a commit to LamentXU123/php-src that referenced this pull request Sep 21, 2026
* PHP-8.4:
  Fix phpGH-21999: GC inconsistency after lazy object properties ht is added to roots (php#22013)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GC assertion zend_gc_delref(zend_refcounted_h *): Assertion `p->refcount > 0' failed

2 participants