From: mikaelkael
Operating system: Debian Squeeze
PHP version: 5.4.0alpha3
Package: Class/Object related
Bug Type: Bug
Bug description:Inherited constructor signature: new behavior of PHP5.4 or bug?
Description:
------------
I just experiment this behavior with PHP5.4a3 when running the following
code:
<?php
abstract class Zend_Pdf_FileParserDataSource
{
abstract public function __construct();
}
class Zend_Pdf_FileParserDataSource_File extends
Zend_Pdf_FileParserDataSource
{
public function __construct($filePath)
{}
}
$test = new Zend_Pdf_FileParserDataSource_File('path');
// Throw a Fatal Error:
/*
PHP Fatal error: Declaration of
Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
that of Zend_Pdf_FileParserDataSource::__construct() in
/home/mikaelkael/php54.php on line 11
Fatal error: Declaration of
Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
that of Zend_Pdf_FileParserDataSource::__construct() in
/home/mikaelkael/php54.php on line 11
*/
It throws a fatal error (like a "normal" class method in 5.3). But this
code was OK for the constructor in 5.3. In case of new behavior, is it
possible to document it? I can't find any informations in NEWS or in
UPGRADE files.
Test script:
---------------
<?php
abstract class Zend_Pdf_FileParserDataSource
{
abstract public function __construct();
}
class Zend_Pdf_FileParserDataSource_File extends
Zend_Pdf_FileParserDataSource
{
public function __construct($filePath)
{}
}
$test = new Zend_Pdf_FileParserDataSource_File('path');
// Throw a Fatal Error:
/*
PHP Fatal error: Declaration of
Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
that of Zend_Pdf_FileParserDataSource::__construct() in
/home/mikaelkael/php54.php on line 11
Fatal error: Declaration of
Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
that of Zend_Pdf_FileParserDataSource::__construct() in
/home/mikaelkael/php54.php on line 11
*/
--
Edit bug report at https://bugs.php.net/bug.php?id=55375&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55375&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55375&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55375&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55375&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55375&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55375&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55375&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55375&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55375&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55375&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55375&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55375&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55375&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55375&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55375&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55375&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55375&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55375&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55375&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55375&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55375&r=mysqlcfg