Skip to content

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

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

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.

@maximilian-walter maximilian-walter pushed a commit that referenced this issue Nov 6, 2012
Maximilian Walter Removed abstract method AbstractPrompt::show() (Issue #2899) 4b3deb8
@weierophinney
Zend Framework member
@sha1
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
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
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
Zend Framework member
@weierophinney weierophinney reopened this Feb 5, 2013
@weierophinney weierophinney added a commit to weierophinney/zf2 that referenced this issue Feb 5, 2013
@weierophinney weierophinney [#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.
493130d
@weierophinney weierophinney was assigned 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

@ghost Unknown pushed a commit that referenced this issue Jul 14, 2013
@weierophinney weierophinney [#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.
e79902e
@isularifin isularifin referenced this issue in bolt/bolt Mar 25, 2015
Closed

Can't inherit abstract function #3230

@weierophinney weierophinney added a commit to zendframework/zend-console that referenced this issue May 15, 2015
@weierophinney weierophinney [zendframework/zf2#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.
3d4cdca
@gianarb gianarb pushed a commit to zendframework/zend-console that referenced this issue May 15, 2015
@Maks3w Maks3w Merge pull request zendframework/zf2#3681 branch 'hotfix/declare-abst…
…ract-method' Fix zendframework/zf2#2899
6c2eca4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.