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 with set() functions #1072

Open
Seb33300 opened this issue Feb 27, 2025 · 5 comments
Open

Bug with set() functions #1072

Seb33300 opened this issue Feb 27, 2025 · 5 comments

Comments

@Seb33300
Copy link

Seb33300 commented Feb 27, 2025

Hello,

On a Laravel project, I am using deployer where a set() function is defined to setup the global configurations.

Since PHP-Parser version 5.4.0, it seems like something wrong happened with that set() function, breaking my Pint (PHP-CS-Fixer for Laravel) pipelines in my project.

I created a reproducer in the Pint project here: laravel/pint#353

This seems to be related somehow to latest changes in PropertyHook where I can see some set hardcoded?
See: 6478c5a#diff-7b34ed55e32983d7ed56a09fc70ba016f0b84cf024c8062b8dcb2682157edca4

@Seb33300
Copy link
Author

Seb33300 commented Feb 27, 2025

Can also be related to phpstan/phpstan-src#3746
@ondrejmirtes ?

@Seb33300
Copy link
Author

Seb33300 commented Feb 27, 2025

Only PHP-Parser seems to have been updated when the issue occured for the first time.
So the issue is more likely to come from PHP-Parser.

This

<?php

if (true) {
    set();
}

Results into this somehow:

<?php

if (true) {
    {set();}
}

@nikic
Copy link
Owner

nikic commented Mar 2, 2025

To confirm, you're seeing this issue with PHP-Parser 5.4.0, but not if you downgrade to 5.3.1?

The changes to PropertyHook should not be related to this, as your code is a plain function call, not a property hook.

@Seb33300
Copy link
Author

Seb33300 commented Mar 4, 2025

I am facing this bug with Pint 1.19.0, but not with Pint 1.18.3.

PHP-Parser was upgraded from v5.3.1 to v5.4.0. (but this was not the only one lib upgraded).
I just found some mentions to set in your changelog so I though it may be related.

Since I created that issue, someone also created a very similar issue happening with get() function.

@ondrejmirtes
Copy link
Contributor

This is a low-level library. Please debug this issue further so we can see where the bug is. It might not be in PHP-Parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants