Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Jun 6, 2017
Merged

[TwigBridge] Fix namespaced classes #23073

merged 1 commit into from
Jun 6, 2017

Conversation

ogizanagi
Copy link
Contributor

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

@alOneh
Copy link
Contributor

alOneh commented Jun 5, 2017

I do the same fix, too late... ;)

@GromNaN
Copy link
Member

GromNaN commented Jun 5, 2017

The test needs to be completed.

fabpot added a commit to twigphp/Twig that referenced this pull request Jun 5, 2017
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
@weaverryan
Copy link
Member

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 :)

@fabpot
Copy link
Member

fabpot commented Jun 6, 2017

Thank you @ogizanagi.

@fabpot fabpot merged commit a1cdc2d into symfony:2.7 Jun 6, 2017
fabpot added a commit that referenced this pull request Jun 6, 2017
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
@fabpot fabpot mentioned this pull request Jun 6, 2017
@ogizanagi ogizanagi deleted the fix/twig_bridge/namespaced_classes branch June 6, 2017 04:17
@ogizanagi
Copy link
Contributor Author

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.

@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.

This was referenced Jun 7, 2017
@fabpot fabpot mentioned this pull request Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants