|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-08 01:43 UTC] kbcmdba at gmail dot com
Description:
------------
Incomplete implementations of extended classes don't cause an error message back to the user.
Test script:
---------------
<?php
class fooBase {
abstract public function mustImplement() {
// This must be implemented.
}
abstract public function youMustImplementThisToo() {
// This must be implemented too.
}
}
class foo extends fooBase {
public function bar() {
echo "Hello world\n" ;
}
}
echo "Made it here... That makes sense.\n" ;
$c = new foo() ;
$c->bar() ;
echo "... but not here and without an error message or warning.\n" ;
Expected result:
----------------
Fatal Error: The foo class is an incomplete implementation of the fooBase class in foo.php.
Concrete implementation of mustImplement() is required
Concrete implementation of youMustImplementThisToo() is required
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
I think I misunderstood your report. In any case, it is detached from the reality. Here's what happens: C:\Users\Cataphract\Documents\php-src\Debug_TS>php -l <?php class fooBase { abstract public function mustImplement(); abstract public function youMustImplementThisToo(); } class foo extends fooBase { public function bar() { echo "Hello world\n" ; } } echo "Made it here... That makes sense.\n" ; $c = new foo() ; $c->bar() ; echo "... but not here and without an error message or warning.\n" ; ^Z Fatal error: Class fooBase contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (fooBase::mustImplement, fooBase::youMustImplementThisToo) in - on line 6 Errors parsing -