-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Error Cannot redeclare class Twig_Environment #2495
Comments
Please try with the latest version of the branch (a bugfix was merged in 1.x after the 04ef7a1 commit) ? and make sure you clear your OPCache cache |
I updated and I removed cache
And the problem continue:
:( |
Everything works correctly if fixed the commit.
|
can you give the stack trace of the exception ? |
I dont have profiler. I only see the following error: And in the logs... only I see:
|
Hey I've a same problem. The 1.x.dev is not a release version, you can have bugs. BR |
/cc @nicolas-grekas |
@GuigZ- or @Chrysweel, in src/Environment.php, can you try replacing the "require" by "require_once" please? Any change? |
And which php version? |
@GuigZ- or @Chrysweel I tried reproducing the issue but I can't sorry. If you can't provide a reproducer, I'll need your help to do "remote" debugging :) |
I've seen a similar error in the past when a client had more than one opcache extension enabled at the same time (e.g. PHP opcache + XCache). |
Can someone tell if #2497 makes a difference? |
Without feedback, and while I wondered about this without finding any way this can happen, I'm inclined to think this is related to a badly resetted OPcache. |
@nicolas-grekas I updated vendors again, now my commit is:
And I changed require -> require_once:
My php version:
I get the same error. I am in environment app_dev.php in my project symfony.
|
@Chrysweel thanks for the feedback. Are you using Apache or PHP-FPM? Can you try restarting it? |
Another question: how does it behave if you replace the "require" line in src/Environment.php by this? |
Composer just updated me to 2.4.0 which I see just got released 20 minutes ago, and immediately received the error as well. I had 2.3.2 before Here's a stack trace: in Environment.php line 17 |
Similar to @richard4339 it just updated from 1.33.2 to 1.34.0 in a composer update and the same 500 error occurred. I reverted back to 1.33.2 and it has resolved the issue. Using Symfony 3.1 for reference. |
@richard4339 thanks for the report, can you try the advice just before? |
Like this ?
Nothing change, same error (Using symfony 2.8) |
I'm failing to find the require line in Environment.php to change @nicolas-grekas |
@richard4339 in the "src" folder of twig (not in "lib") Another idea, might be the one:
can you try replacing them by a class_exists check for the corresponding class? |
If it works, I invite you to open a PR :) (against branch 1.x) |
I made the PR :) |
2.4.1 works beautifully @nicolas-grekas!!! Thanks! |
cool, thanks for confirming! |
Hey, Your fix does not work. I try the last version (v1.34.2) and i've this error : PHP message: PHP Fatal error: Cannot redeclare class Twig_Node in app/cache/recette/classes.php on line xxxx |
Clear your cache :) |
Not fix the problem :) I clear all cache ;). I create an PR to fix the problem. #2506 |
See: twigphp/Twig#2495 This problem was fixed in twig 1.34.4, so configuring that specific version as minimum version in composer.json.
See: twigphp/Twig#2495 This problem was fixed in twig 1.34.4, so configuring that specific version as minimum version in composer.json.
See: twigphp/Twig#2495 This problem was fixed in twig 1.34.4, so configuring that specific version as minimum version in composer.json.
I updated vendors, and only update version twig.
But now I get the following error:
I cleared cache... but the error continue... I did a compare two commits... but I dont see nothing unusual...
460712d...04ef7a1#diff-d4416d290253c72cec40c63f54354b16
any idea ?
This is my composer
The text was updated successfully, but these errors were encountered: