[horde] php-4.4.0 woes

Joeri Pronk joeri at joeri.nu
Mon Jul 18 03:11:15 PDT 2005


Most of the problems are with using a & before a function call:
$ref = &this_function_returns_a_reference();

Only thing that needs to be done is to remove the & before the function 
call. The function is defined as to return a reference, in this case 
older PHP versions would try to reference the reference which could 
cause the memory corruption.

The other problem with references lies in functions which return (the 
rsults of) functions or expressions. They need to be rewritten to 
return a variable.

old:
function &get_something() {
  return some_otherthing();
}
new:
function &get_something() {
  $value=some_otherthing();
  return $value;
}

I wonder if anybody on the horde project is already looking into this, 
or should I post a bug report on this?
If not I will hereby volunteer to make some patches to solve this problem.


----- Bericht van dick at nagual.st ---------
    Datum: Sun, 17 Jul 2005 16:38:28 +0200
      Van: dick hoogendijk <dick at nagual.st>
Antwoorden aan:dick hoogendijk <dick at nagual.st>
Onderwerp: Re: [horde] php-4.4.0 woes
      Aan: horde <horde at lists.horde.org>


> On 17 Jul Joeri Pronk wrote:
>
>> I can confirm this, 4.4.0 contains some serious memory corruption
>> fixes when using references.
>
> Glad to hear this, although..
>
>> As I see it all the code needs to reviewed for incorrect references,
>> fortunately they are easy to fix.
>
> Easy to fix? Can you tell me more on this please?
>
> --
> dick -- http://nagual.st/ -- PGP/GnuPG key: F86289CE
> ++ Running FreeBSD 4.11-stable ++ FreeBSD 5.4
> + Nai tiruvantel ar vayuvantel i Valar tielyanna nu vilja
> --
> Horde mailing list - Join the hunt: http://horde.org/bounties/#horde
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: horde-unsubscribe at lists.horde.org
>


----- Einde bericht van dick at nagual.st -----





More information about the horde mailing list