PHP References
Posted: Sun Sep 11, 2005 2:42 am
Wow. So I've upgraded my development box to PHP 5.0.5, which has the new, more restrictive references model (as does PHP 4.4.0). It turns out that a lot of things I thought were acceptable are no longer permitted. For example, immediate functions are restricted:
For Example, the following is now forbidden:
Instead, you have to store the output of the explode in an intermediate variable. You may be able to get away with:
as well.
Another thing that's breaking a bunch of my modules is smarty references. I do a lot of things like:
which, as far as I know, have to be changed to
I'll be updating all of my modules as time permits. First will be the Skeleton, so my bad coding practices don't screw anyone who's working on writing their own modules.
For Example, the following is now forbidden:
Code: Select all
$var = array_pop(explode('/',$path));
Code: Select all
$var = array_pop(@explode('/',$path));
Another thing that's breaking a bunch of my modules is smarty references. I do a lot of things like:
Code: Select all
$this->smarty->assign_by_ref('localized_string', $this->Lang('my_string'));
Code: Select all
$this->smarty->assign('localized_string', $this->Lang('my_string'));