-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[TwigBridge] Fix namespaced classes #23073
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
[TwigBridge] Fix namespaced classes #23073
Conversation
ogizanagi
commented
Jun 5, 2017
Q | A |
---|---|
Branch? | 2.7 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #23072 |
License | MIT |
Doc PR | N/A |
I do the same fix, too late... ;) |
This PR was merged into the 1.x branch. Discussion ---------- Use class_exists instead of require I think this is required for symfony/symfony#23073 to pass. It's probably very similar to symfony/symfony#22657. A simple reproducer: ```php <?php use Twig\Node\Node; require_once __DIR__ . '/vendor/autoload.php'; new Node(); new \Twig_Node(); ``` [Without this patch](https://travis-ci.org/symfony/symfony/jobs/239712676#L2100): ```php PHP Fatal error: Cannot declare class Twig_Node, because the name is already in use in vendor/twig/twig/lib/Twig/Node.php on line 20 ``` With, everything works fine, whatever the two calls order. Commits ------- 2c174e4 Use class_exists instead of require
Was this the only file that had an issue? It's the only one that caused issues for me, but I wasn't sure if possibly some bad find/replace caused issues in other files. And yea... it's not technically needed, but it would be awesome if the test was extended to catch this - it's surprising to see an error like this not caught by a test. And mostly, thanks for the fast PR :) |
Thank you @ogizanagi. |
This PR was merged into the 2.7 branch. Discussion ---------- [TwigBridge] Fix namespaced classes | Q | A | ------------- | --- | Branch? | 2.7 <!-- see comment below --> | Bug fix? | yes | New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #23072 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A Commits ------- a1cdc2d [TwigBridge] Fix namespaced classes
@weaverryan : I confirm. I did an inspection for other class not found occurrences in the bridge and the bundle but didn't find anything else. |