PHP Zend Engine Extension and Static Methods

When writing an extension for php (5.3), I want to access the pointer zend_class_entryfor a static method.

In the case of non-static methods, I can use the macro getThis()inside the macro Z_OBJCE_Pas well:

zend_class_entry ce* = Z_OBJCE_P(getThis());

Now the problem: with static methods, the macro getThis()returns a pointer null, so I can not use the macro Z_OBJCE_P.

Does anyone have a solution to access zend_class_entryfrom a static method?

+3
source share
1 answer

: ,

zend_class_entry* ce = 0L;
if (EG(called_scope)) {
    ce = EG(called_scope);
} else if (!EG(scope))  {
    ce = EG(scope);
}

EG - , , .

+3

Source: https://habr.com/ru/post/1781751/


All Articles