|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-24 17:27 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 11:00:01 2025 UTC |
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