-
-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP 8.2 deprecation warning: callables and self
#2405
Comments
Encountered same issue. Made a small test extension to highlight the C code generation.
The C code generated will contain the C-macro If instead , func1 is defined in another class, defined in swork.zep, and func2 is changed to call that instead
The C code generated will contain the C-macro Need a little test.php script to call up the "calling self" deprecation message --- With self::, scall:: or static:: invocation and ZEPHIR_RETURN_CALL_SELF macro, This ZEPHIR_RETURN_CALL_SELF macro seems to be involved in generation of bogus looking optimisations involving caching of zend information. Scanning the involved C code gave me an immediate rejection headache. I would be happier if it just trusted the known zend class entry, and used that in all possible cases.
|
Checking a bit further, if a static function call, calls itself recursively it also generates the same error message, this time through this macro - ZEPHIR_RETURN_CALL_STATIC("func1", NULL, 0, &_2$$4); Again the deprecation warning message can be avoided by substitution with ZEPHIR_RETURN_CALL_CE_STATIC |
I think the issue is the zend api funtion "zend_is_callable_check_class" that throws the deprecation notice. That is called by "zend_is_callable_at_frame" and "zend_is_callable_check_func" "zephir_call_user_func_array_noex" calls "zend_id_callable_at_frame" but this is not the issue. The issue is in ZEPHIR_CALL_SELF So tracing it is So ZEPHIR_CALL_SELF and ZEPHIR_RETURN_CALL_SELF calls zephir_call_class_method_aparams in the 4th passed parameter has getThis(). I guess getThis returns self. @betrixed gave the idea or ZEPHIR_RETURN_CALL_CE_STATIC, but i.e in Tag, zephir has to translate this
Or, I am guessing that maybe something like this in the 2nd parameter could fix it? either that or we change self with Object::class? |
Is this fixed in Phalcon 5.5? |
Still on it. |
#2405 - Suppress callable deprecations
Deprecation warnings removed in PHP 8.2+ |
Isn't it resolved only about callables, but not about self? |
@s-ohnishi all 3: |
That’s great news. Is a stable release planned addressing this? |
Good news. |
Nice to see good results for this issue |
@fichtner Releasing today |
excellent news |
Related issue:
phalcon/cphalcon#16263
For PHP 8.2 when calling a static method we get a warning about using
self
in callables.Example
Phalcon\Tag
Tag::linkTo(....)
will call internallylet urlService = self::getUrlService()
and that issues the warning.The text was updated successfully, but these errors were encountered: