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

filemtime warning because of eval'd code #492

Closed
yard-mschwartz opened this issue Mar 19, 2024 · 4 comments
Closed

filemtime warning because of eval'd code #492

yard-mschwartz opened this issue Mar 19, 2024 · 4 comments

Comments

@yard-mschwartz
Copy link

yard-mschwartz commented Mar 19, 2024

This ticket concerns 1.13.* and 2.* of this package.

Currently, I'm trying to upgrade an application from Symfony 5.4 to Symfony 6.0 (and then later to the most recent 6.x).

This halted my progress:

$ symfony console cache:clear

In PsrCachedReader.php line 222:
                                                                                                                                                                          
  Warning: filemtime(): stat failed for /home/.../my-project/vendor/lexik/jwt-authentication-bundle/Security/Authenticator/ForwardCompatAuthenticatorTrait.php(14) : eval()'d code

Turns out a solution was already suggested by someone else in #436, but this solution was never merged. Two changes in lib/Doctrine/Common/Annotations/PsrCachedReader.php solve the issue for me:

  • Adding use function is_file; on top
  • Changing [$filename ? filemtime($filename) : 0] to [is_file($filename) ? filemtime($filename) : 0] in two places

Would this be a good improvement for the package, or am I missing something?

P.S. I'll also try to upgrade lexik/jwt-authentication-bundle to 3.* once it becomes available, because the ForwardCompatAuthenticatorTrait only seems to exist in 2.*.

@malarzm
Copy link
Member

malarzm commented Mar 19, 2024

The best course of action is to migrate away from doctrine/annotations and use attributes :)

@yard-mschwartz
Copy link
Author

Yes, fair point. I am aware of this. It would help me and potentially others if this could be done in steps, but it's likely that I will try to move on in one go later this week.

@derrabus
Copy link
Member

Feel free to submit a PR with the proposed fix and a test that reproduces the issue.

@stof
Copy link
Member

stof commented Sep 9, 2024

Fixed in #494

@stof stof closed this as completed Sep 9, 2024
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

4 participants