PHP 5.4.0RC1 + ZFv1

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PHP 5.4.0RC1 + ZFv1

Adam Lundrigan
All,

I've created a JIRA issue to track the effort of updating ZFv1 to be
compatible with PHP 5.4.0, starting now with RC1
(ZF-11906<http://framework.zend.com/issues/browse/ZF-11906#>).
The first major thing i've come across is in Zend_Pdf, and would like to
seek your opinion on whether the fix breaks BC:

abstract class Zend_Pdf_FileParserDataSource defines it's constructor stub
without any arguments, however concrete implementations
Zend_Pdf_FileParserDataSource_File and Zend_Pdf_FileParserDataSource_String
both have constructors which take a single argument (filename and string,
respectively).  I don't believe this is a PHP 5.4 specific issue (see:
http://www.php.net/manual/en/language.oop5.abstract.php#83153), though it
is still an issue.  The question is whether or not the constructor
signature in the abstract base class can be changed to have a single
parameter without breaking BC?

Message:
PHP Fatal error:  Declaration of
Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
Zend_Pdf_FileParserDataSource::__construct() in
library/Zend/Pdf/FileParserDataSource/File.php on line 41



Adam Lundrigan, B.Sc, ZCE
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: PHP 5.4.0RC1 + ZFv1

Mike Willbanks
Hi Adam,

abstract class Zend_Pdf_FileParserDataSource defines it's constructor stub

> without any arguments, however concrete implementations
> Zend_Pdf_FileParserDataSource_File and Zend_Pdf_FileParserDataSource_String
> both have constructors which take a single argument (filename and string,
> respectively).  I don't believe this is a PHP 5.4 specific issue (see:
> http://www.php.net/manual/en/language.oop5.abstract.php#83153), though it
> is still an issue.  The question is whether or not the constructor
> signature in the abstract base class can be changed to have a single
> parameter without breaking BC?
>
> Message:
> PHP Fatal error:  Declaration of
> Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with
> Zend_Pdf_FileParserDataSource::__construct() in
> library/Zend/Pdf/FileParserDataSource/File.php on line 41
>

Realistically the abstract class should never have a constructor; and if it
does need one the signature should match the next.  One thing you can do is
simply remove the constructor if it is not "required".  If it must be a
requirement; then simply add the filename parameter.  However, IMO the
abstract class should not define a constructor argument unless it will
ALWAYS have a single argument etc... If not, then let the concrete
implementations deal with it.

Removing the constructor from the abstract class:
phpunit Zend/Pdf/
............................................................ 60 / 99
.......................................

Time: 1 second, Memory: 28.75Mb

OK (99 tests, 274 assertions)

Regards,

Mike