Edit report at http://bugs.php.net/bug.php?id=51900&edit=1
ID: 51900
Comment by: justin dot rebelo at gmail dot com
Reported by: jrdoane at gmail dot com
Summary: Abstract Method Not Overridden will Halt PHP.
Status: Bogus
Type: Bug
Package: Class/Object related
Operating System: Ubuntu 9.10/RHEL 4
PHP Version: 5.2.13
Block user comment: N
Private report: N
New Comment:
For what it's worth, I have been having this same issue for some time on
my
ubuntu-based workstation. It took me while to narrow it down to just
this
situation but I have the following issue.
Declare an abstract class:
abstract class Foo {
abstract public function test () {
}
}
class Bar extends Foo {
}
When Bar.php gets loaded, PHP dies instantly and silently. Nothing is
logged,
nothing is printed to browser and when run on CLI, nothing prints to
console.
phpinfo verifies:
error_reporting = E_ALL
display_errors = 1
display_startup_errors = 1
I also use xdebug and have stepped through the code to the point where
it dies
after including the offending file and I get no useful information
through it
either.
I am using PHP Version 5.3.3-1ubuntu9.3
Previous Comments:
------------------------------------------------------------------------
[2010-06-09 14:26:40] jrdoane at gmail dot com
Display_Errors is on.
E_ALL is being displayed.
No change, I checked this before submitting a bug report.
------------------------------------------------------------------------
[2010-06-08 13:11:29] [email protected]
Not reproducible.
Please enable error reporting and make sure display_errors is set to
On.
PHP 5.3.99-dev
PHP 5.3.3-dev
PHP 5.2.14-dev
All these versions report a fatal error:
Fatal error: Class example contains 1 abstract method and must therefore
be declared abstract or implement the remaining methods (abcEx::foo) in
/tmp/1.php on line 4
------------------------------------------------------------------------
[2010-05-24 17:27:48] jrdoane at gmail dot com
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 this bug report at http://bugs.php.net/bug.php?id=51900&edit=1