Skip to content

Conversation

@joelwurtz
Copy link
Contributor

@joelwurtz joelwurtz commented Oct 17, 2023

Not sure if this is wanted, so this is a first shot into adding a ZendIterator type to handle all objects that have an iterator and allow custom extension to use them in a more friendly way

It should work for any class that extends Traversable, but not for array, a super type may be needed if we want to support iterable type : which is mainly either an array or a Traversable

TODO:

  • documentation

joehoyle and others added 30 commits December 20, 2022 14:19
Currently we only support throwing exception class entries, i.e. stateless exceptions. Ideally we also want to support throwing a ZVal which has a ClassEntry that extends the Exception PHP class. This can be used to throw stateful exceptions which is not uncommon.

This PR is missing one piece: `throw_object` will currently `drop` the Zval when the function is completed, causing reference / null pointer errors. It seems `ZVal::Drop` doesn't actually free the zval currently, it just sets the type to NULL (which also breaks things.) Discussed briefly in https://discord.com/channels/115233111977099271/1025314959179120714 on how best to solve this, but I'm not totally clear still! Ideally I think we want `throw_object` to own the `zval` but not free it once the function returns.
This is akin to ExecutorGlobals, but for the process globals
This allows extensions to register and unregister custom stream wrappers
@danog
Copy link
Collaborator

danog commented Nov 24, 2023

Changed my mind on the design a bit, refactoring...

@danog danog merged commit 3d66f17 into extphprs:master Nov 24, 2023
@danog
Copy link
Collaborator

danog commented Nov 24, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants