Skip to content

GH-16317: make __debugInfo() overrides work #16333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

DanielEScherzer
Copy link
Member

No description provided.

Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Arguably, those extensions don't correctly handle the ZEND_PROP_PURPOSE_DEBUG flag in their get_properties_for handler. This may even accidentally circumvent handling of ZEND_PROP_PURPOSE_DEBUG in correctly implemented handlers. It's true that they could instead implement get_debug_info, or simply __debugInfo. This is (likely) historical, so right now we need to support all of these cases.

// GH-16317: for user classes with __debugInfo() always call that
if (ce->type == ZEND_USER_CLASS && ce->__debugInfo != NULL) {
int is_temp;
myht = (std_object_handlers.get_debug_info)(zobj, &is_temp);
Copy link
Member

Choose a reason for hiding this comment

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

get_debug_info is technically an optional handler.

Copy link
Member Author

Choose a reason for hiding this comment

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

Generally it is optional, but can it ever be unset from the global std_object_handlers?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the default handlers may be removed. I don't know exactly why you would do that, but it is currently marked as optional, and its existence is checked for within zend_std_get_properties_for().

@DanielEScherzer
Copy link
Member Author

Okay, I've started sending individual patches, #16543 and #16544 so far, all do other extensions once those merge
Someone with the rights may want to restore the patch at #12534

@iluuu1994
Copy link
Member

Thanks, I reopened GH-12534. Let's close this PR then.

@iluuu1994 iluuu1994 closed this Oct 22, 2024
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