php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53259 Incomplete implementations of extended classes don't cause an error
Submitted: 2010-11-08 01:43 UTC Modified: 2010-11-10 18:04 UTC
From: kbcmdba at gmail dot com Assigned:
Status: Wont fix Package: Class/Object related
PHP Version: 5.3.3 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
36 + 18 = ?
Subscribe to this entry?

 
 [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




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-08 01:55 UTC] cataphract@php.net
-Status: Open +Status: Wont fix
 [2010-11-08 01:55 UTC] cataphract@php.net
What doesn't make sense is this request.

So it fails without a message and not on where the error actually is...
 [2010-11-08 09:22 UTC] kbcmdba at gmail dot com
I would have hoped that PHP would at least 
have given some indication of what was 
wrong. Using php -l doesn't report a problem 
either.  It would help a lot if that wasn't the 
case so we'd at least have some help tracking 
down the bug / oops.

Why do you say the request doesn't make 
sense?

KB
 [2010-11-10 18:04 UTC] cataphract@php.net
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 -
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC