Skip to content

Fix GH-24743: var_export() ignores exception from nested object export - #24746

Open
lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-24743-var-export-exception
Open

lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-24743-var-export-exception

Conversation

@lazerg

@lazerg lazerg commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The object branch of php_var_export_ex() ignored the result of php_object_element_export(), so when a property hook threw inside a nested object, the outer object kept exporting and var_export() printed a partial result before the exception. Now it releases the recursion guard and properties and returns FAILURE, the same way the array branch already does. A lazy object whose initializer throws had the same problem (the exception comes from zend_get_properties_for()), so that is checked too.

Fixes #24743

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.

1 participant