lisachenko / z-engine

:zap: PHP Engine Direct API
MIT License
448 stars 22 forks source link

[Feature] Provide a read-only API to the global object store #18

Closed lisachenko closed 4 years ago

lisachenko commented 4 years ago

All objects in PHP are also stored in the EG(objects_store) which is plain array of references to the object entries. This library can provide API for this store to query an object by its identifier/handle, available via spl_object_id(). ObjectStore should implement Countable and ArrayAccess interfaces to access objects in the store. It would be nice to wrap each returned zend_object entry into the ObjectEntry instance to have full control over objects.

lisachenko commented 4 years ago

Unpleasant part: the zend_executor_globals structure contains C #ifdef parts, thus it is platform-dependent, need to handle this case with a preprocessor, like https://github.com/ircmaxell/php-c-parser by @ircmaxell