Skip to content
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

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

Closed
Jeckerson opened this issue Mar 9, 2023 · 21 comments
Closed

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

Jeckerson opened this issue Mar 9, 2023 · 21 comments
Assignees
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report

Comments

@Jeckerson
Copy link
Member

Jeckerson commented Mar 9, 2023

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 Jeckerson added bug A bug report status: unverified Unverified labels Mar 9, 2023
@Jeckerson Jeckerson self-assigned this Mar 9, 2023
@Jeckerson Jeckerson added 5.0 The issues we want to solve in the 5.0 release and removed status: unverified Unverified labels Mar 9, 2023
@yesworld
Copy link

Same issue.

@s-ohnishi
Copy link

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

Jeckerson added a commit that referenced this issue Jun 30, 2023
Jeckerson added a commit that referenced this issue Jun 30, 2023
Jeckerson added a commit that referenced this issue Jun 30, 2023
Jeckerson added a commit that referenced this issue Jul 1, 2023
@Jeckerson
Copy link
Member Author

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

@hakimio
Copy link

hakimio commented Jul 21, 2023

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

@robert-deepnorth
Copy link

I still get these error on PHP 8.2.9 and Phalcon 5.2.3

@yesworld
Copy link

Same...

@hakimio
Copy link

hakimio commented Aug 17, 2023

This was only partially resolved: #16376 (comment)

EDIT: open bug report: #16263
EDIT2: zephir language bug report: zephir-lang/zephir#2405

@joel-teratis
Copy link

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

@niden
Copy link
Member

niden commented Nov 27, 2023

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.

@shovv
Copy link

shovv commented Dec 6, 2023

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

@niden
Copy link
Member

niden commented Dec 12, 2023

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.

@s-ohnishi
Copy link

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.

@kunalray1993
Copy link

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

@magroski
Copy link

Is this fixed in Phalcon 5.5?

@kunalray1993
Copy link

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

@dev-fan
Copy link

dev-fan commented Jan 25, 2024

Is this fixed in Phalcon 5.5?

No. 5.6 same error

@sjcrookes
Copy link

sjcrookes commented Jan 25, 2024

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
Copy link

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

@niden
Copy link
Member

niden commented Feb 8, 2024

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

@sjcrookes
Copy link

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

@niden
Copy link
Member

niden commented Feb 8, 2024

It was all @Jeckerson bud :)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0 The issues we want to solve in the 5.0 release bug A bug report
Projects
None yet
Development

No branches or pull requests