Skip to content

json - fix OOM error message on hook branch - #24992

Merged
arnaud-lb merged 1 commit into
php:PHP-8.4from
adapik:fix/json-oom-unprotect-hooked-8.4
Oct 29, 2026
Merged

arnaud-lb merged 1 commit into
php:PHP-8.4from
adapik:fix/json-oom-unprotect-hooked-8.4

Conversation

@adapik

@adapik adapik commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Every exit path unprotects recursion_rc, except the ZEND_HAS_OOM() branch taken when escaping an object/array key fails. It unprotects myht instead, so for hooked classes the object keeps GC_PROTECTED set. That branch also returns without freeing tmp, the value read through the get hook, which the neighbouring error paths release.

Fixes a regression from 3584a98 - @arnaud-lb please have a look

@arnaud-lb

Copy link
Copy Markdown
Member

Thank you @adapik. Could you add a test and a NEWS entry?

@adapik
adapik force-pushed the fix/json-oom-unprotect-hooked-8.4 branch 2 times, most recently from 68e881f to 77ba05d Compare October 29, 2026 06:38
@adapik

adapik commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

PR updated: NEWS entry and test added.

@adapik
adapik force-pushed the fix/json-oom-unprotect-hooked-8.4 branch from 77ba05d to 69af4b8 Compare October 29, 2026 07:37
@arnaud-lb
arnaud-lb merged commit 303bb88 into php:PHP-8.4 Oct 29, 2026
18 checks passed
arnaud-lb added a commit that referenced this pull request Oct 29, 2026
* PHP-8.6:
  Fix json_encode() reporting false "Recursion detected" after OOM for hooked-property objects (#24992)
@arnaud-lb

Copy link
Copy Markdown
Member

Thank you!

arnaud-lb added a commit to lazerg/php-src that referenced this pull request Oct 29, 2026
* PHP-8.4:
  Fix json_encode() reporting false "Recursion detected" after OOM for hooked-property objects (php#24992)
arnaud-lb added a commit to lazerg/php-src that referenced this pull request Oct 29, 2026
* PHP-8.5:
  Fix json_encode() reporting false "Recursion detected" after OOM for hooked-property objects (php#24992)
arnaud-lb added a commit to lazerg/php-src that referenced this pull request Oct 29, 2026
* up/PHP-8.6:
  Fix json_encode() reporting false "Recursion detected" after OOM for hooked-property objects (php#24992)
  Fix phpGH-25023: ZEND_CONTAINER_OF() fails to compile with -std=c11 (php#25027)
  Fix flaky FPM test for bug #77023 (php#24999)
  Update GitHub Action workflows to `actions/checkout@v7` (8.6)
  Update GitHub Action workflows to `actions/checkout@v7` (8.5)
  Update GitHub Action workflows to `actions/checkout@v7` (8.4)
  Update GitHub Action workflows to `actions/checkout@v7`
  Fix phpGH-23626: OPcache: orphaned temporaries cause leaks and assertions
  [ci skip] Fix comment
  Fix block pass dropping ZEND_FAST_CALL OP2 definition
  Fix phpGH-23572: JIT calls wrong static method from trait clones
  Fix phpGH-24784: Preserve certificates when reading PKCS7/CMS CRLs (php#24785)
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.

2 participants