https://github.com/lstrojny/class-resolver
Intercepts PHPs "new" operator to execute a callback for name resolval
https://github.com/lstrojny/class-resolver
Last synced: 3 months ago
JSON representation
Intercepts PHPs "new" operator to execute a callback for name resolval
- Host: GitHub
- URL: https://github.com/lstrojny/class-resolver
- Owner: lstrojny
- Created: 2011-02-26T00:12:41.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-06-12T02:41:34.000Z (almost 14 years ago)
- Last Synced: 2024-10-30T06:58:11.424Z (7 months ago)
- Language: C
- Homepage:
- Size: 121 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Design
## Implementation overview
- Find all class declarations from `CG(class_table)`
- Override `ce->create_object` with `php_classresolver_create_object()`
- If custom `create_object`-function exists: store old `ce->object_new` in `CLASSRESOLVER_G(object_new)`
- Custom `create_object` handler:
- If class resolver is registered, resolve class name with `Class\Resolver::resolve()`
- Retrieve related class entry
- Return `zend_object_value` with new class entry
- If configurator is registered, pass original constructor parameters and classname to `Class\Configurator::preConstruct()`## Userland API
```php