Skip to content

Conversation

@alexandre-daubois
Copy link
Member

Use zend_update_property() instead of doing things "manually".

@alexandre-daubois alexandre-daubois linked an issue Nov 3, 2025 that may be closed by this pull request
@alexandre-daubois alexandre-daubois marked this pull request as ready for review November 3, 2025 09:02
Copy link
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

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

On a phone , so can't check. But you're looking at the property info now, however dynamic properties don't have any. So that means that a dynamically created property $stream would've been overwritten before this patch but now no longer. So that is an unintended behaviour change.

@alexandre-daubois
Copy link
Member Author

Oh alright, I wasn't aware of this subtlety of dynamic properties. Let's refine that.

@bukka
Copy link
Member

bukka commented Nov 3, 2025

Hmm so that would require to someone create the dynamic property in filter first and it could then be used in subsequent calls for stream, right? If so, that sounds like a proper edge case... :)

@ndossche
Copy link
Member

ndossche commented Nov 3, 2025

The easiest way to test this is to create a onCreate method that sets a dynamic property on $this

Warning: fwrite(): Unprocessed filter buckets remaining on input brigade in %s on line %d
TypeError: Cannot assign resource to typed property

Fatal error: Uncaught TypeError: Cannot assign resource to property pass_filter::$stream of type int in %s
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused - the TypeError: Cannot assign resource to typed property presumably comes from the manual echo on line 29, so where does this uncaught fatal error come from?

Copy link
Member

Choose a reason for hiding this comment

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

Also why is there a manual echo in the first place instead of echoing the value of getMessage() ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I reworked the test file

@ndossche
Copy link
Member

ndossche commented Nov 4, 2025

This will work, except for a pre-existing bug:
When there is an unset or uninit typed property, but it is declared, its existence will be ignored.

It would also be great to try to avoid OBJPROP so that the property table isn't rebuilt, but that isn't critical.

@alexandre-daubois
Copy link
Member Author

alexandre-daubois commented Nov 4, 2025

I tried to implement what you have in mind in 04e0955

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.

User filters allow breaking typed properties

4 participants