Can't inherit abstract function Zend\Console\Prompt\PromptInterface::show() #2899

Closed
maximilian-walter opened this Issue Nov 6, 2012 · 5 comments

Comments

Projects
None yet
5 participants
@maximilian-walter

With PHP 5.3.2 I get the following error:

PHP Fatal error:  Can't inherit abstract function Zend\Console\Prompt\PromptInterface::show() (previously declared abstract in Zend\Console\Prompt\AbstractPrompt) in /path/to/Zend/Console/Prompt/AbstractPrompt.php on line 24

If I remove the abstract method "show()" in AbstractPrompt (line 40), then everything is fine. In my opinion this fix has no side-effects, because the function is declared in the PromptInterface, so it has to be implemented anyway.

To reproduce this, you have to use a class with extends AbstractPrompt, eg:

Prompt\Line::prompt("Example");

With a newer version of PHP (5.3.18) the problem doesn't occur.

@weierophinney

This comment has been minimized.

Show comment
Hide comment
@weierophinney

weierophinney Nov 6, 2012

Member

Our minimum supported PHP version is 5.3.3, and this is one reason why.

On Tuesday, November 6, 2012, maximilian-walter wrote:

With PHP 5.3.2 I get the following error:

PHP Fatal error: Can't inherit abstract function Zend\Console\Prompt\PromptInterface::show() (previously declared abstract in Zend\Console\Prompt\AbstractPrompt) in /path/to/Zend/Console/Prompt/AbstractPrompt.php on line 24

If I remove the abstract method "show()" in AbstractPrompt (line 40), then
everything is fine. In my opinion this fix has no side-effects, because the
function is declared in the PromptInterface, so it has to be implemented
anyway.

To reproduce this, you have to use a class with extends AbstractPrompt, eg:

Prompt\Line::prompt("Example");

With a newer version of PHP (5.3.18) the problem doesn't occur.


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/2899.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

Member

weierophinney commented Nov 6, 2012

Our minimum supported PHP version is 5.3.3, and this is one reason why.

On Tuesday, November 6, 2012, maximilian-walter wrote:

With PHP 5.3.2 I get the following error:

PHP Fatal error: Can't inherit abstract function Zend\Console\Prompt\PromptInterface::show() (previously declared abstract in Zend\Console\Prompt\AbstractPrompt) in /path/to/Zend/Console/Prompt/AbstractPrompt.php on line 24

If I remove the abstract method "show()" in AbstractPrompt (line 40), then
everything is fine. In my opinion this fix has no side-effects, because the
function is declared in the PromptInterface, so it has to be implemented
anyway.

To reproduce this, you have to use a class with extends AbstractPrompt, eg:

Prompt\Line::prompt("Example");

With a newer version of PHP (5.3.18) the problem doesn't occur.


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/2899.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

@sha1

This comment has been minimized.

Show comment
Hide comment
@sha1

sha1 Jan 31, 2013

Actually, this is a problem under Windows 7 & PHP 5.3.8 too. The provided fix resolves the issue.

sha1 commented Jan 31, 2013

Actually, this is a problem under Windows 7 & PHP 5.3.8 too. The provided fix resolves the issue.

@raykolbe

This comment has been minimized.

Show comment
Hide comment
@raykolbe

raykolbe Feb 4, 2013

I'm on PHP 5.3.5, just performed a Composer update to 2.0.7 release and I get this error.

Please a) fix the issue or b) increase the version number for min-required PHP.

raykolbe commented Feb 4, 2013

I'm on PHP 5.3.5, just performed a Composer update to 2.0.7 release and I get this error.

Please a) fix the issue or b) increase the version number for min-required PHP.

@raykolbe

This comment has been minimized.

Show comment
Hide comment
@raykolbe

raykolbe Feb 4, 2013

Just upgraded PHP to 5.3.14 and it works fine on that version, so PHP 5.3.3 is misleading as a min-requirement here.

raykolbe commented Feb 4, 2013

Just upgraded PHP to 5.3.14 and it works fine on that version, so PHP 5.3.3 is misleading as a min-requirement here.

@weierophinney

This comment has been minimized.

Show comment
Hide comment
@weierophinney

weierophinney Feb 4, 2013

Member

Actually, 5.3.3 as the minimum required version is correct; we need to fix
the code to work on 5.3.3.

On Mon, Feb 4, 2013 at 9:08 AM, Raymond Kolbe notifications@github.comwrote:

Just upgraded PHP to 5.3.14 and it works fine on that version, so PHP *
5.3.3* is misleading as a min-requirement here.


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/2899#issuecomment-13080747.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

Member

weierophinney commented Feb 4, 2013

Actually, 5.3.3 as the minimum required version is correct; we need to fix
the code to work on 5.3.3.

On Mon, Feb 4, 2013 at 9:08 AM, Raymond Kolbe notifications@github.comwrote:

Just upgraded PHP to 5.3.14 and it works fine on that version, so PHP *
5.3.3* is misleading as a min-requirement here.


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/2899#issuecomment-13080747.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

@weierophinney weierophinney reopened this Feb 5, 2013

weierophinney added a commit to weierophinney/zendframework that referenced this issue Feb 5, 2013

[#2899] Remove redundant method declaration
- Re-declaring a method as abstract when defined in an interface being
  implemented can lead to issues under some versions of PHP. Removing
  the abstract method in the abstract class fixes the issue.

@ghost ghost assigned weierophinney Feb 5, 2013

@Maks3w Maks3w closed this in cd6d4ac Feb 6, 2013

@SchumacherFM SchumacherFM referenced this issue in SchumacherFM/Anonygento Feb 24, 2013

Closed

PHP Fatal error: Can't inherit abstract function #1

@isularifin isularifin referenced this issue in bolt/bolt Mar 25, 2015

Closed

Can't inherit abstract function #3230

weierophinney added a commit to zendframework/zend-console that referenced this issue May 15, 2015

[zendframework/zendframework#2899] Remove redundant method declaration
- Re-declaring a method as abstract when defined in an interface being
  implemented can lead to issues under some versions of PHP. Removing
  the abstract method in the abstract class fixes the issue.

gianarb pushed a commit to zendframework/zend-console that referenced this issue May 15, 2015

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