Re: PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all
| From: | Michael Muryn | Date: | Thu, 16 Apr 2009 00:07:03 +0000 |
| Subject: | Re: PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-51749@lists.php.net to get a copy of this message | ||
Access has finally been unblocked, I opened this bug:
http://pear.php.net/bugs/bug.php?id=16108
Thanks,
- Michael
""Michael Muryn"" <mickoz@parodius.com> wrote in message
news:DD.19.19857.8A916E94@pb1.pair.com...
>I would have opened a bug but the bug-report system tell me "Email is
>already in use for an existing account" and for some reason I never
>received a confirmation email by posting a bug, nor by trying to open an
>account (with username: mickoz) on PEAR (I posted some hours ago about it,
>if someone can help me with that!).
>
> So here is the bug report I was gonna submit:
>
> -----
>
> PHP version: 4.4.4
> Package: PEAR
> Package version: 1.8.1
> Operating system: Linux
>
> Summary:
> --------
>
> PEAR_PackageFile_Generator_v2 PHP4 parse error when running upgrade-all
>
> Description:
> ------------
>
> After running:
> # pear upgrade-all
> I got this parse error on PHP4:
> Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$'
> in
> /usr/local/lib/php/PEAR/PackageFile/Generator/v2.php on line 380
>
> The problem seems to be with the &$c in the foreach in this code of the
> file:
> foreach ($arr['changelog']['release'] as &$c) {
> if (isset($c['notes'])) {
> // This trims out the indenting, needs fixing
> $c['notes'] = "\n" . trim($c['notes']) .
> "\n";
> }
> }
>
> Without having analyzing what you are trying to do but only reading the
> syntax...
> either we do not want to put a "&" there or if we really want to use it as
> reference,
> we might want to use this technique to iterate an array by reference that
> is
> compatible in PHP4 and PHP5:
> foreach (array_keys(arr['changelog']['release']) as $c_key)
> {
> $c =& $arr['changelog']['release'][$c_key];
> ...
> }
>
> For an unknown reason, I have not noticed this error on all my pear
> installation. And this error prevented me to upgrade from PEAR 1.7.2 to
> 1.8.1. The only difference with this PEAR installation is that it is an
> user-specific PEAR installation upgraded by the system PEAR (the system
> PEAR is up to date to 1.8.1, but not this user installation, so that is
> probably a new problem with PEAR > 1.7.2).
>
> From http://www.php.net/foreach it states that this feature
> (foreach by
> reference) is available since PHP5:
> As of PHP 5, you can easily modify array's elements by preceding $value
> with &.
> This will assign reference instead of copying the value.
>
>
>