PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » File Formats » File_Archive » Bug #4159

Archive.php Parse Error in PHP4

Details

Submitted2005-04-15 22:36 UTC
Fromdmytton at php dot net
Assignedvincentlascaux
StatusClosed
PackageFile_Archive
PHP Version4.3.11
OSLinux Fedora Core 2
Roadmaps(Not assigned)

Comments

[2005-04-15 22:36 UTC] dmytton at php dot net

Description:
------------
File_Archive works perfectly only PHP5(.0.3) however, when testing on my live, production server running PHP 4.3.11, I get a parse error. This error does not exist when using PHP5.

Looking at bug #3894, parameters passed by reference cannot have a default value in PHP4, but they can in PHP5.

This is fixed by removing the passed by reference.

Reproduce code:
---------------
Line 368 of Archive.php:

368: function readMulti(&$sources = array())
369: {
370: require_once "File/Archive/Reader/Multi.php";
371: $result = new File_Archive_Reader_Multi();

Actual result:
--------------
Parse error: parse error, unexpected '=', expecting ')' in /home/expanse/public_html/upload/includes/classes/archive/File/Archive.php on line 368

[2005-04-15 23:03 UTC] lascauv4 at cti dot ecp dot fr

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

Thanks for your feedback
I thought the problem with PHP 4 was only when giving a null default value to a reference parameter...
You are right that passing by copy is OK (the elements inside the array must not be copied, but the array itself can)

The bug is corrected on the CVS