[support] PHP 5.3 upgrade problems

Earnie Boyd earnie at users.sourceforge.net
Wed Oct 14 16:00:09 UTC 2009


Quoting andy baxter <andy at earthsong.free-online.co.uk>:
>
> I assume that the last declaration is the relevant one because of the
> '&$element'. This function looks like this:
>
> /**
>  * FormAPI theme function. Theme the output of an image field.
>  */
> function theme_imagefield_widget(&$element) {
>   drupal_add_css(drupal_get_path('module', 'imagefield')
> .'/imagefield.css');
>   return theme('form_element', $element, $element['#children']);
> }
>
>

It isn't necessarily the definition of the function that is wrong.  It  
is the data being passed to the function as it is defined that is the  
problem.  You need to find all the uses of theme_imagefield_widget and  
make sure that the data being used in the parameter is a variable.

>
> I could just remove the & in front of the parameter name in both cases,
> but doing that without understanding what I am doing makes me nervous.
> Why would another function be passing a variable by value when the
> function expects a reference? Is this just bad coding which PHP <5.3
> used to cover for, or some older feature which has been removed?
>

The & means "by reference".  See  
http://php.net/manual/en/language.references.pass.php for  
explanations.  You'll quickly see what should be fixed.

--
Earnie
-- http://r-feed.com/           -- http://for-my-kids.com/
-- http://www.4offer.biz/       -- http://give-me-an-offer.com/




More information about the support mailing list