Page 1 of 1
calling member function in php 5
Posted: Wed Jun 10, 2009 5:49 pm
by tedyu
I use the following code to call member function:
_StoredProcs::$this->_serializerOptions['rootName']($this->AccountParams);
It works fine in php 4.
php 5 gave me fatal error:
Call to undefined function create() in ...
Has anyone else encounter this problem ?
Re: calling member function in php 5
Posted: Wed Jun 10, 2009 5:52 pm
by requinix
We have absolutely no idea what you're talking about.
Re: calling member function in php 5
Posted: Wed Jun 10, 2009 6:41 pm
by tedyu
_StoredProcs has member function create() among others.
$this->_serializerOptions['rootName'] holds the name of member function.
Such syntax is accepted by php 4.
Re: calling member function in php 5
Posted: Wed Jun 10, 2009 7:02 pm
by requinix
Could be the precedence rules changed in PHP 5, but I'm not seeing any mention of :: or -> in the charts.
Try
Code: Select all
_StoredProcs::{$this->_serializerOptions['rootName']}($this->AccountParams);
Re: calling member function in php 5
Posted: Wed Jun 10, 2009 7:21 pm
by tedyu
That produces:
[Wed Jun 10 10:23:33 2009] [error] [client 10.10.129.94] PHP Parse error: syntax error, unexpected '{', expecting T_STRING or T_VARIABLE or '$' in
Re: calling member function in php 5
Posted: Wed Jun 10, 2009 7:30 pm
by requinix
Guess it doesn't work statically (too lazy to test it myself).
As a quick sanity check,
Code: Select all
$function = $this->_serializerOptions['rootName'];
_StoredProcs::$function($this->AccountParams);
If, for some reason, that doesn't work,
Code: Select all
$function = array("_StoredProcs", $this->_serializerOptions['rootName']);
$function($this->AccountParams);
One of those should work. If not then you have other problems.