Edit report at http://bugs.php.net/bug.php?id=51900&edit=1
ID: 51900 Updated by: tony2...@php.net Reported by: jrdoane at gmail dot com Summary: Abstract Method Not Overridden will Halt PHP. -Status: Open +Status: Bogus Type: Bug Package: Class/Object related Operating System: Ubuntu 9.10/RHEL 4 PHP Version: 5.2.13 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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