'Overriding' a private static method with a different signature causes crash

Bug #61761 'Overriding' a private static method with a different signature causes crash
Submitted: 2012-04-18 07:28 UTC Modified: 2012-04-18 10:18 UTC
From: hughes dot corbin at gmail dot com Assigned: laruence (profile)
Status: Closed Package: Reproducible crash
PHP Version: 5.4.0 OS: Windows 7 Prof x64
Private report: No CVE-ID: None

 [2012-04-18 07:28 UTC] hughes dot corbin at gmail dot com

Description:
------------

If error_reporting is set to report E_STRICT (any mask involving it being high), 
then PHP will crash if a private static method is 'overriden' with a different 
signature.  Since the method is private, it is, as far as I know, theoretically 
valid to override it (and thus it shouldn't even cause a strict warning).  
However, when overriding it, PHP crashes.

I wish I could post a backtrace, but I'm on Windows and don't currently have 
access to the proper tools.


An interesting note: Even linting the test file provided (php -l test.php) will 
cause the crash.  This makes me think that it's in the strict routine that the 
crash is happening, though that's only speculation.  My guess is that PHP starts 
to flag the strict notice when it sees that the method signatures do not match, 
and then the private comes into play and makes it crash.  (With public or 
protected visibility there is no crash and the expected strict notice is 
generated).


php.net build of PHP 5.4.0: PHP 5.4.0 (cli) (built: Feb 29 2012 19:24:02)

Windows 7 Professional x64 (32 bit version of PHP)

Test script:
---------------
<?php

class A
{
	private static function test($a) { }
}

class B extends A
{
	private static function test($a, $b) { }
}

?>

Expected result:
----------------
Nothing.  The file should parse correctly.

Actual result:
--------------
Crashes.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2012-04-18 10:18 UTC] laruence@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence