php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61778 Crash when overloaded method called from class constructor
Submitted: 2012-04-19 20:20 UTC Modified: 2012-05-04 21:28 UTC
From: james dot thomsen at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.4.2 OS: Windows 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: james dot thomsen at gmail dot com
New email:
PHP Version: OS:

 

 [2012-04-19 20:20 UTC] james dot thomsen at gmail dot com
Description:
------------
If a class overrides a method but with a different signature and that method is called in the constructor and if error_reporting is set to display strict errors and if the classes are defined in reverse order, PHP will crash.  In my test script, if class one is defined before class two, PHP won't crash.  I realize that overridden methods need to have identical signatures, but I would expect a warning and not a crash.

Test script:
---------------
error_reporting(-1);
class two extends one{
    public function __construct(){
        $this->error(7);
    }
    private function error($n){
        echo 'two';
    }
}
class one{
    private function error(){
        echo 'one';
    }
}
new two;

Expected result:
----------------
two

Actual result:
--------------
FastCGI Error
The FastCGI Handler was unable to process the request.

Error Details:

    The FastCGI process exited unexpectedly
    Error Number: -2147467259 (0x80004005).
    Error Description: Unspecified error

HTTP Error 500 - Server Error.
Internet Information Services (IIS)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-20 00:19 UTC] nikic@php.net
This script runs fine on CLI for me. Could you see whether running on CLI works for you?
 [2012-04-20 00:31 UTC] james dot thomsen at gmail dot com
Yes, it crashes at the command line too.  The windows event logs record the 
crash.


Event Type:	Error
Event Source:	Application Error
Event Category:	(100)
Event ID:	1000
Date:		4/19/2012
Time:		1:40:27 PM
User:		N/A
Computer:	SPWEB01
Description:
Faulting application php-cgi.exe, version 5.4.0.0, faulting module php5.dll, 
version 5.4.0.0, fault address 0x002f8b80.

For more information, see Help and Support Center at 
http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 41 70 70 6c 69 63 61 74   Applicat
0008: 69 6f 6e 20 46 61 69 6c   ion Fail
0010: 75 72 65 20 20 70 68 70   ure  php
0018: 2d 63 67 69 2e 65 78 65   -cgi.exe
0020: 20 35 2e 34 2e 30 2e 30    5.4.0.0
0028: 20 69 6e 20 70 68 70 35    in php5
0030: 2e 64 6c 6c 20 35 2e 34   .dll 5.4
0038: 2e 30 2e 30 20 61 74 20   .0.0 at 
0040: 6f 66 66 73 65 74 20 30   offset 0
0048: 30 32 66 38 62 38 30      02f8b80
 [2012-04-20 00:33 UTC] nikic@php.net
Just checked again: This was already fixed in https://github.com/php/php-src/commit/da6465a268d9ece2ffd38447890b206dd94b3250, that's why it was running fine for me.

So this should be fixed in PHP 5.4.1 :)
 [2012-04-20 00:33 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2012-05-04 21:28 UTC] james dot thomsen at gmail dot com
-PHP Version: 5.4.0 +PHP Version: 5.4.2
 [2012-05-04 21:28 UTC] james dot thomsen at gmail dot com
I just upgraded to PHP 5.4.2 and the test script still crashes PHP.  I have run the script on two different Windows servers.  I am running IIS with fastCGI.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 19:01:30 2024 UTC