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 using HeadTitle viewer without Translator module #4626

Closed
kafeltz opened this Issue Jun 11, 2013 · 4 comments

Comments

Projects
None yet
4 participants
@kafeltz

kafeltz commented Jun 11, 2013

It is correct in the layout.phtml the headTitle helper be set to null when not using translator component?

I don't know why disabling "translator" component in module.config.php my app stop working because $this->headTitle() does not exists anymore.

Fatal error: Method Zend\View\Helper\HeadTitle::__toString() must not throw an exception in C:\Projetos\php\php 5.4\module\Application\view\layout\layout.phtml on line 0

To reproduce the error is simple.
Just create a ZendSkeletonApplication, remove translator component from module.config.php and remove all translator helpers inside the views.

I think this is wrong if i understood correctly, because the manual says this helpers are built-in and shouldn't be necessary to import.

@weierophinney

This comment has been minimized.

Show comment
Hide comment
@weierophinney

weierophinney Jun 11, 2013

Member

What exactly did you comment out?

If I comment out only the translator configuration -- i.e., https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/config/module.config.php#L64-L73 -- all works as intended. It's only when I remove the alias from "translator" to "MvcTranslator" (https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/config/module.config.php#L60-L62) that I observe the issue.

This makes sense, as even though you're not using translation, the helpers are still consuming the Translate view helper as a dependency -- which means the translator service needs to be present.

We may revisit this (again) for ZF3, but there's simply not an easy answer to the situation. Leave the alias present, and you'll be fine -- there will be no overhead, as the translator has no configuration, and thus effectively is disabled for the intent of the view helpers.

Member

weierophinney commented Jun 11, 2013

What exactly did you comment out?

If I comment out only the translator configuration -- i.e., https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/config/module.config.php#L64-L73 -- all works as intended. It's only when I remove the alias from "translator" to "MvcTranslator" (https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/config/module.config.php#L60-L62) that I observe the issue.

This makes sense, as even though you're not using translation, the helpers are still consuming the Translate view helper as a dependency -- which means the translator service needs to be present.

We may revisit this (again) for ZF3, but there's simply not an easy answer to the situation. Leave the alias present, and you'll be fine -- there will be no overhead, as the translator has no configuration, and thus effectively is disabled for the intent of the view helpers.

@kafeltz

This comment has been minimized.

Show comment
Hide comment
@kafeltz

kafeltz Jun 11, 2013

You're right.

I thought it was wrong about these dependencies.

Thank you for responding.

kafeltz commented Jun 11, 2013

You're right.

I thought it was wrong about these dependencies.

Thank you for responding.

@mbn18

This comment has been minimized.

Show comment
Hide comment
@mbn18

mbn18 Nov 13, 2013

Contributor

Hi, I did as suggested and then I got:

PHP Fatal error:  Uncaught exception 'Zend\\I18n\\Exception\\ExtensionNotLoadedException' with message 'Zend\\I18n\\Translator component requires the intl PHP extension'

I installed the extension and the problem was solved.

Before commenting out the translator conf, ZF2 didnt used the php-intl extension.
So do we need this extension for proper usage or it better to find replacement?

Contributor

mbn18 commented Nov 13, 2013

Hi, I did as suggested and then I got:

PHP Fatal error:  Uncaught exception 'Zend\\I18n\\Exception\\ExtensionNotLoadedException' with message 'Zend\\I18n\\Translator component requires the intl PHP extension'

I installed the extension and the problem was solved.

Before commenting out the translator conf, ZF2 didnt used the php-intl extension.
So do we need this extension for proper usage or it better to find replacement?

@namtrungtruong

This comment has been minimized.

Show comment
Hide comment
@namtrungtruong

namtrungtruong Feb 17, 2017

Change config in php.ini

uncomment

;extension=php_intl.dll

namtrungtruong commented Feb 17, 2017

Change config in php.ini

uncomment

;extension=php_intl.dll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment