-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
read_property() handler is not supposed to return NULL #8362
read_property() handler is not supposed to return NULL #8362
Conversation
NULL is never expected as a result of read_property() handler, it should return &EG(uninitialized_zval) if there is no such property in the object
I agree this makes sense to fix. But can I ask how you encountered this? User code should never be accessing message properties directly. |
It's not that easy. I believe that's actually the problem with protobuf extension - it always presumes that user should not be doing this or that. There are no safety checks, it just crashes if user does something it was not designed to do (like instantiating an internal class manually). |
I agree we should enforce these rules whenever possible. For example there is #8002 which might have been able to prevent this. |
This handler is called throughout the Zend engine code and in none of the cases the result is checked for NULL because the engine expects it to be a valid zval.
If there is no such property, the object has to return &EG(uninitialized_zval).