Skip to content

Fix GH-19801: address leak when calling var_dump() with recursion in __debugInfo() - #19837

Merged
alexandre-daubois merged 1 commit into
php:PHP-8.3from
alexandre-daubois:vd-leak
Sep 16, 2025
Merged

alexandre-daubois merged 1 commit into
php:PHP-8.3from
alexandre-daubois:vd-leak

Conversation

@alexandre-daubois

@alexandre-daubois alexandre-daubois commented Sep 15, 2025 •

Copy link
Copy Markdown
Member

Fix #19801

Also fixes the same issue in debug_zval_dump(). I wasn't able to reproduce the issue with var_export() however.


Note: ext/standard/tests/general_functions/debug_zval_dump_gh19801_memory_leak.phpt should be updated on upmerge to add packed to the internal array representation

@alexandre-daubois alexandre-daubois linked an issue Sep 15, 2025 that may be closed by this pull request
@alexandre-daubois
alexandre-daubois marked this pull request as ready for review September 15, 2025 09:05
@ndossche

Copy link
Copy Markdown
Member

What's wrong with zend_array_release (or similar)? Then you don't need zval wrapping

@alexandre-daubois

alexandre-daubois commented Sep 15, 2025 •

Copy link
Copy Markdown
Member Author

Nothing wrong apart that I forgot about it, tests still green with it on my machine. PR updated 🙂

Comment thread ext/standard/var.c Resolved
Comment thread ext/standard/var.c Resolved

@arnaud-lb arnaud-lb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Thank you!

@alexandre-daubois
alexandre-daubois merged commit 75217c1 into php:PHP-8.3 Sep 16, 2025
8 checks passed
@alexandre-daubois
alexandre-daubois deleted the vd-leak branch September 16, 2025 13:05
alexandre-daubois added a commit that referenced this pull request Sep 16, 2025
* PHP-8.3:
  Fix GH-19801: address leak when calling var_dump() with recursion in __debugInfo() (#19837)
alexandre-daubois added a commit that referenced this pull request Sep 16, 2025
* PHP-8.4:
  Fix GH-19801: address leak when calling var_dump() with recursion in __debugInfo() (#19837)
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.

var_dump() may leak dumped value

3 participants