Bug #51900 [NEW]: Abstract Method Not Overridden will Halt PHP.

From: Date: Mon, 24 May 2010 15:27:49 +0000
Subject: Bug #51900 [NEW]: Abstract Method Not Overridden will Halt PHP.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150772@lists.php.net to get a copy of this message
From:             
Operating system: Ubuntu 9.10/RHEL 4
PHP version:      5.2.13
Package:          Class/Object related
Bug Type:         Bug
Bug description:Abstract Method Not Overridden will Halt PHP.

Description:
------------
if you have an abstract class that gets overridden, if a method that is
overridden has a default where the abstract doesn't, PHP just halts without
any error, warning, or fatal. For small projects this is manageable, but
when you have a large project, hunting down these things take a long time,
such as a multi-thousand lined library loaded with abstract classes.

These are the folowing versions of PHP that I've tested:
$ php --version
PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: Jan  6 2010
22:56:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

and

<This is a RHEL box. (Red Hat Enterprise Linux ES release 4 (Nahant Update
8))>
$ php --version
PHP 5.2.13 (cli) (built: Apr  6 2010 18:40:35)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies


Test script:
---------------
runme.php
<?php
include("file1.php"); // Fails here because a method isn't overridden.
// Just halts, no errors with error_reporting on and error output set to
E_ALL.
// The included file never actually executes any code unless the $bar in
// the abstract class is changed to $bar=null, which fixes the problem,
but
// finding the problem to begin with is the problem.
?>

file1.php
<?php
include_once("file2.php");
class example extends absEx {
    function foo($bar=null) {
        // Do something
    }
}
?>

file2.php
<?php
abstract class absEx {
    abstract function foo($bar);
}
?>

Expected result:
----------------
Error: Abstract method not overridden (Line: ##### OR method name)

Actual result:
--------------
# PHP halts suddenly with no error output.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51900&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51900&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51900&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51900&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51900&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51900&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51900&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51900&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51900&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51900&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51900&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51900&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51900&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51900&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51900&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51900&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51900&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51900&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51900&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51900&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51900&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51900&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#150772) next »