Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Can't inherit abstract function Zend\Validator\Translator\TranslatorInterface::translate() #5354

Closed
ppeiris opened this issue Oct 26, 2013 · 5 comments
Assignees
Milestone

Comments

@ppeiris
Copy link

ppeiris commented Oct 26, 2013

I get this error

Can't inherit abstract function Zend\Validator\Translator\TranslatorInterface::translate() (previously declared abstract in Zend\I18n\Translator\TranslatorInterface) in vendor/zendframework/zendframework/library/Zend/Mvc/I18n/Translator.php on line 16

I get the error when I run the code on mac using MAMP (php -v 5.4.17); however running the same code base on ubuntu with php -v 5.4.9 wont give any issues.

I fix the issue by commenting translate() in the Zend\I18n\Translator\TranslatorInterface.php. I assume, since its in the interface class and all the translator methods are already implemented, this (may) not effect the code.

@ghost ghost assigned DASPRiD Oct 26, 2013
@Maks3w
Copy link
Member

Maks3w commented Oct 26, 2013

@ppeiris May you're running the code from the CLI (Mac defaults is 5.3.x)

@DASPRiD May you should attend this.

@weierophinney
Copy link
Member

This is a known issue on the develop branch for pre-5.3 versions of PHP; @DASPRiD has indicated he'll have something this week to correct the situation.

Basically: we have two TranslatorInterface definitions, one in Zend\I18n and one in Zend\Validator. Zend\Mvc\I18n\Translator is implementing both -- something that works fine starting in 5.4, but which causes issues in 5.3. The solution will most likely be to do a proxy or decorator.

@weierophinney
Copy link
Member

"Fixed" in the develop branch by upping the minimum supported PHP version to 5.3.23 for the develop branch (upcoming 2.3.0).

@sumityadav
Copy link

Is this still an issue or resolved?

I found this issue when I was working on http://zf2.readthedocs.org/en/latest/tutorials/unittesting.html

PHP Fatal error:  Can't inherit abstract function Zend\Validator\Translator\TranslatorInterface::translate() (previously declared abstract in Zend\I18n\Translator\TranslatorInterface) in zendframework\library\Zend\Mvc\I18n\Translator.php on line 19

OS: Windows 7
PHP: PHP 5.4.12 (cli) (built: Feb 25 2013 00:29:22)
ZF2 Version: 2.3.1

@mungiud
Copy link

mungiud commented Jul 2, 2014

so, how i can resolv this error, i have php 5.3.8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants