Re: [PHP-PEAR] variable method names
[email protected] (Kendrick Vargas)
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 13 Feb 2001, John Donagher wrote:
> There is a call_user_method() function in the current development
> version of CVS, which will make it into the next release.
Well, there is a version of this function in 4.0.4pl1 release, and unless
the code has changed significantly, then it's a rather crippled function
and unsuitable to my needs.
I've needed something like this since 4.0RC1 has been out, and there
hasn't been anything stable in the way of an implementation that can do
what I need to do. eval() used to work (kinda), but it no longer returns
the return value from the called function, so it's also useless. At the
time 4.0RC1 came about, there was no call_user_method().
I would like to be able to call variable methods from within my class, and
have those methods modify variables within the class. It would appear that
call_user_method() makes a copy of $this instead of working on the actual
original $this. Therefore it doesn't work for me. I reported a bug: 9054.
A friend of mine that saw the bug posting looked through the php source
for the function and told me that it relies on the _ex set of functions
(or something like that) which is what makes the copy... so the fix would
lie deeply nestled within the code, to deep for him to fix easily and
probably too deep to come out anytime soon.
For now this works, and is the only reliable thing I've found that does
work. All I'm asking is the proper way to write the statement :-)
> I'm not sure if support via language operators like you listed below
> will be present..
I sure hope not. It bothered me that the behavior of eval changed, and
call_user_method() as far as I can tell does not work.
-peace
--- BEGIN GEEK CODE BLOCK ----------+----------
GAT d- s:+ !a C++$ UL/S/I/B++++$ P+ | "In the ongoing battle between objects
L++ E- W+(+++) N K- w(---) O-- M@ | made of aluminum going hundreds of
V(--) PS+++ PE Y+ PGP@ t++ 5 X+ R- | miles per hour and the ground going
tv+ b- DI++++ D+(+++) G e>++ h--- | zero, the ground has yet to lose."
r++ z+>+++ - END GEEK CODE BLOCK ---+
> On Tue, 13 Feb 2001, Kendrick Vargas wrote:
>
> > I was wondering what would be the correct way to write a variable method
> > name within a class function:
> >
> > $this->$method($value);
> >
> > or
> >
> > $this->{$method}($value);
> >
> > ? Many thanks in advance :-)