php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hughes dot corbin at gmail dot com
New email:
PHP Version: OS:

 

 [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 09:44 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1b29ba61de23f1e4d10472bf5dc1bf1db3f96328
Log: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
 [2012-04-18 09:50 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1bbb5069ff794f812ea0a67bdcbc928cecd0b10a
Log: Revert &quot;Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)&quot;
 [2012-04-18 10:16 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da6465a268d9ece2ffd38447890b206dd94b3250
Log: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
 [2012-04-18 10:17 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=da6465a268d9ece2ffd38447890b206dd94b3250
Log: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
 [2012-04-18 10:18 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-04-18 10:18 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-10-07 23:26 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=da6465a268d9ece2ffd38447890b206dd94b3250
Log: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
 [2014-10-07 23:37 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=da6465a268d9ece2ffd38447890b206dd94b3250
Log: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC