cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: Use of "static" in callables is deprecated

Open Jeckerson opened this issue 3 years ago • 21 comments

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

Jeckerson avatar Mar 09 '23 11:03 Jeckerson

Same issue.

yesworld avatar Apr 11 '23 14:04 yesworld

It seems to happen with other methods as well. For View: Use of "self" in callables is deprecated

s-ohnishi avatar Jun 26 '23 02:06 s-ohnishi

Seems to be fixed in current versions of PHP, closing for now.

Jeckerson avatar Jul 09 '23 17:07 Jeckerson

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

hakimio avatar Jul 21 '23 08:07 hakimio

I still get these error on PHP 8.2.9 and Phalcon 5.2.3

robert-deepnorth avatar Aug 17 '23 04:08 robert-deepnorth

Same...

yesworld avatar Aug 17 '23 09:08 yesworld

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

hakimio avatar Aug 17 '23 09:08 hakimio

Is there any update? This is still happening for me with Phalcon 5.4.0 and PHP 8.2.12

joel-teratis avatar Nov 27 '23 14:11 joel-teratis

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.

niden avatar Nov 27 '23 14:11 niden

Hi, is there any updates? prediction release date? Or any workaround in meantime?

shovv avatar Dec 06 '23 16:12 shovv

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.

niden avatar Dec 12 '23 21:12 niden

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.

s-ohnishi avatar Dec 13 '23 02:12 s-ohnishi

The same error is also in the latest version. I'm using PHP v8.2.13 & Phalcon v5.4.0.

kunalray1993 avatar Dec 19 '23 12:12 kunalray1993

Is this fixed in Phalcon 5.5?

magroski avatar Dec 26 '23 16:12 magroski

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

kunalray1993 avatar Dec 28 '23 08:12 kunalray1993

Is this fixed in Phalcon 5.5?

No. 5.6 same error

dev-fan avatar Jan 25 '24 13:01 dev-fan

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

sjcrookes avatar Jan 25 '24 22:01 sjcrookes

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

sjcrookes avatar Feb 08 '24 20:02 sjcrookes

https://github.com/phalcon/cphalcon/releases/tag/v5.6.1

niden avatar Feb 08 '24 20:02 niden

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

sjcrookes avatar Feb 08 '24 20:02 sjcrookes