-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #80575: Casting mysqli to array produces null on every field #6587
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
base: PHP-7.4
Are you sure you want to change the base?
Conversation
We implement a `get_properties_for` handler for casting to array, and also use this instead of the `get_debug_info` handler.
Will the patch also work in PHP 8.0.1 and upcoming versions or just the Long Term Support versions???? |
@derrabus Does Symfony Dumper need (array) to work, or would a __debugInfo() implementation also work? |
Will this also fix |
Oh, indeed, it would. |
@nikic If If the |
Any objections on merging this? |
@cmb69 Per @derrabus comment specifying |
I have implemented |
Implementing |
So how to proceed? Would it make sense to only apply the fix for the array cast (first commit) to PHP-7.4+, and to implement __debugInfo() for PHP 8.0 or 8.1? |
break; | ||
default: | ||
return zend_std_get_properties_for(object, purpose); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, what I had in mind is implementing only __debugInfo
and dropping the internal get_debug_info
/get_properties_for
handler
To put it in userland terms,
At least that's my view on various "property-table" overloading in internal classes. |
Thanks for the explanation, @nikic, and I generally agree, but aren't the properties declared in this case: Lines 628 to 647 in 38ad37a
As I understand it, mysqli mixed declared properties with dynamic getters/setters. :/ |
@cmb69 It's a mix of constants, static properties and functions hidden behind |
@kamil-tekiela, well, they are declared as properties with value NULL to the engine. This is why casting to array (which is not especially catered to) yields these NULL values. Anyhow, suggestions on how to proceed here are welcome! |
Below I have classified all properties from the mysqli extension. They are all documented as instance properties, but internally they are static, instance, constant or dynamic properties.
The static and constant ones are still implemented via To be honest, I don't know how to handle casting these objects to an array, or Therefore, I would propose to handle array cast the same as |
Is this still relevant, or have the properties been properly declared now? If yes, a rebase seems in order. |
We implement a
get_properties_for
handler for casting to array, andalso use this instead of the
get_debug_info
handler.