Re: Warning: Call-time pass-by-reference in XML/Parser.php
| From: | Tomas V.V.Cox | Date: | Thu, 13 Sep 2001 23:32:30 +0000 |
| Subject: | Re: Warning: Call-time pass-by-reference in XML/Parser.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1906@lists.php.net to get a copy of this message | ||
"Tobias H. Michaelsen" wrote:
>
> I get a "Warning: Call-time pass-by-reference has been deprecated[...]"
> in XML/Parser.php (line 254).
> This is where the problem is:
>
> call_user_method($elem, $this, $xp, $elem, &$attribs);
>
> Is it possible to change this?
> Maybe to something like this:
>
> $this->$elem($xp, $elem, $attribs);
There is a security problem with this parsing mode. Until more and more
people continues using it, it's time to change the API. Basically the
change involves that the function name instead of being simply $elem it
will be replaced with "xmltag_$elem" (prefixing the "xmltag_" string).
Also we need to change the deprecated call_user_method() with
call_user_func() (making the class incompatible with php < 4.0.6 I
guess).
I know that we hate to break the API or make the class only usable with
the last avaible php version, but is there any other solution? If not
I'll do the changes in the next days.
> and then explane that the user functions should be declared as
>
> function elemName($xp, $elem, &$attribs);
>
> if the pass-by-reference of the attributes is nescessary(?)
>
The gain of speed in most of cases where $attribs are small, the
difference is minimal, but in the cases that $attribs are a big array of
data, increases a lot the speed.
Tomas V.V.Cox