[BUG]: Use of "static" in callables is deprecated
Describe the bug
It throws ErrorException while using model's static method find().
To Reproduce
$rows = Robots::find([
'columns' => 'id',
'conditions' => 'status_id IN ({ids:array})',
'bind' => ['ids' => [1, 3]],
]);
Expected behavior No error.
Details
- Phalcon version: 5.2.1
- PHP Version: 8.2
- Operating System: any
- Installation type: PECL
- Zephir version (if any): 0.17.0
- Server: Other
Same issue.
It seems to happen with other methods as well.
For View:
Use of "self" in callables is deprecated
Seems to be fixed in current versions of PHP, closing for now.
@Jeckerson which version is that exactly? I am on PHP 8.2.7 and Phalcon 5.2.1 and still getting those errors.
I still get these error on PHP 8.2.9 and Phalcon 5.2.3
Same...
This was only partially resolved: https://github.com/phalcon/cphalcon/pull/16376#issuecomment-1643915694
EDIT: open bug report: https://github.com/phalcon/cphalcon/issues/16263 EDIT2: zephir language bug report: https://github.com/zephir-lang/zephir/issues/2405
Is there any update? This is still happening for me with Phalcon 5.4.0 and PHP 8.2.12
Still work in progress. This is hidden deep in Zephir and @Jeckerson has been working to clean things up and fix it.
We have not forgotten this for sure.
Hi, is there any updates? prediction release date? Or any workaround in meantime?
Not yet I'm afraid. We still have other issues to address before this one gets in the pipeline.
Sadly the only hack one can do is reduce the error level on the server - yeah I know it is not a solution, it sucks, but that is what we have for now.
Active support for PHP 8.1 has already ended. I understand that Zephir needs to be modified to fix this bug, but it seems like people are interested in something other than Zephir. (I don't know if this is really necessary) I would like you to raise the priority if possible.
The same error is also in the latest version. I'm using PHP v8.2.13 & Phalcon v5.4.0.
Is this fixed in Phalcon 5.5?
Still, I'm getting the same warnings with the Phalcon 5.5.0 and PHP 8.2.14.
Is this fixed in Phalcon 5.5?
No. 5.6 same error
Same problem in PHP 8.3 and Phalcon 5.6 PECL
php -v
PHP 8.3.2-1+0~20240120.16+debian11~1.gbpb43448 (cli) (built: Jan 20 2024 14:17:59) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies
pecl info phalcon
About pecl.php.net/phalcon-5.6.0
Release Date 2024-01-09 22:59:08
Release Version 5.6.0 (stable)
Required Dependencies PHP version 8.0.0-8.3.99
To reproduce - make a minimal Phalcon App:
Works
$test = \Models\MyModel::find();
Doesn't work
$di->set(
'router',
function () use ($di){
$test = \Models\MyModel::find();
require '/app/routes.php';
return $router;
}
);
Error
Internal Server Error: Exception: "Use of "static" in callables is deprecated
"/app/index.php" @ {closure}[
{
"function": "{closure}"
},
{
"file": "/app/index.php",
"line": 123,
"function": "find",
"class": "Phalcon\\Mvc\\Model",
"type": "::"
},
Looks like this will be fixed in the next release zephir-lang/zephir#2405
https://github.com/phalcon/cphalcon/releases/tag/v5.6.1
https://github.com/phalcon/cphalcon/releases/tag/v5.6.1
Thanks for all your hard work @niden, confirmed is fixed for me in 5.6.1 with PHP 8.3