cphalcon: [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

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 9
  • Comments: 21 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@Jeckerson which version is that exactly? I am on PHP 8.2.7 and Phalcon 5.2.1 and still getting those errors.

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.

It was all @Jeckerson bud 😃

Glad to hear that there are no issues with it. On to new stuff 😃

I still get these error on PHP 8.2.9 and Phalcon 5.2.3

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

Is this fixed in Phalcon 5.5?

No. 5.6 same error

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.

Looks like this will be fixed in the next release zephir-lang/zephir#2405

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": "::"
},

Still, I’m getting the same warnings with the Phalcon 5.5.0 and PHP 8.2.14.