TwigBridge
TwigBridge copied to clipboard
Problem with php 7
Hi, I have an installation of laravel 4.2.17 on php 7 and "rcrowe/twigbridge": "0.6.*@dev" As you might imagine, I get this error
Cannot use 'String' as class name as it is reserved
from TwigBridge\Extension\Laravel\String class
I can't either update laravel or downgrade php
Does #269 fix it?
For now I have replaced Twig with blade since my template is very simple, but I think that renaming String in Str is the right way. Thanks
@barryvdh that commit fixes problem. Can you tag it (both 0.6.x and 0.9.x) please?
@barryvdh , @rcrowe Still having this problem myself: just updated everything via composer today and it's broken (IDE-helper error below, during composer update):
Exception: Cannot instantiate Twig extension 'TwigBridge\Extension\Laravel\String': Class TwigBridge\Extension\Laravel\String does not exist
I am 100% sure it was fixed months ago. What has changed since then?! Wasn't that fix tagged as a release?
You have to update your config file.
I already have checked the readme of this package with my config file. Both providers and aliases are the same. Plus, the latest release here is of February this year. The mentioned fix came in late May. Are you sure it's included in the latest stable release?
Try the latest dev version then, and use the config for extensions from that version
Dear @barryvdh , is it that hard to have a tagged release, or is this package so messed up that the latest dev version is unreliable for a stable release? Now I feel very uneasy lol.
No it should work.
@shehi I've fixed as @barryvdh says.
/*
|--------------------------------------------------------------------------
| Extensions
|--------------------------------------------------------------------------
|
| Enabled extensions.
|
| `Twig_Extension_Debug` is enabled automatically if twig.debug is TRUE.
|
*/
'enabled' => [
'TwigBridge\Extension\Loader\Facades',
'TwigBridge\Extension\Loader\Filters',
'TwigBridge\Extension\Loader\Functions',
'TwigBridge\Extension\Laravel\Auth',
'TwigBridge\Extension\Laravel\Config',
'TwigBridge\Extension\Laravel\Dump',
'TwigBridge\Extension\Laravel\Input',
'TwigBridge\Extension\Laravel\Session',
'TwigBridge\Extension\Laravel\Str', // INSTEAD OF TwigBridge\Extension\Laravel\String
'TwigBridge\Extension\Laravel\Translator',
'TwigBridge\Extension\Laravel\Url',
// 'TwigBridge\Extension\Laravel\Form',
// 'TwigBridge\Extension\Laravel\Html',
// 'TwigBridge\Extension\Laravel\Legacy\Facades',
],
Just migrated an old project with Laravel v4.2.17 to another server with PHP7 using composer update as mentioned in https://github.com/rcrowe/TwigBridge/pull/269#issuecomment-229185888
composer require rcrowe/twigbridge:0.6.x-dev
Since I did not have a specific config file in app config directory, everything worked right away. It saved me hours of fiddling. 👍 💯 🍺