In the engine, each class entry has a union field:
union {
zend_object* (*create_object)(zend_class_entry *class_type);
int (*interface_gets_implemented)(zend_class_entry *iface, zend_class_entry *class_type); /* a class implements this interface */
};
Whereas create_object handler is used for object initialization, theinterface_gets_implemented handler is used for interfaces as a general callback when class implements this concrete interface. This callback can be used for interesting features like automatic class registration/configuration via callback.
There is a requirement for this handler (and interfaces): it should be installed before the first declaration of any class that implements this interface, otherwise you will receive a segfault on second call in FPM, because handler will
In the engine, each class entry has a union field:
Whereas
create_object
handler is used for object initialization, theinterface_gets_implemented
handler is used for interfaces as a general callback when class implements this concrete interface. This callback can be used for interesting features like automatic class registration/configuration via callback.There is a requirement for this handler (and interfaces): it should be installed before the first declaration of any class that implements this interface, otherwise you will receive a segfault on second call in FPM, because handler will