I was using the Ads module (version 6.x-2.1) with PHP 4.4.4. I've just upgraded to PHP 5.3.0 and created a fresh configuration. But now everything seems normal expect that my ads disappear and I get several warnings. Depending on the active ad sub-modules I get a variable number of the following message:

warning: Parameter 2 to ad_image_adapi() expected to be a reference, value given in C:\WebServer\htdocs\drupal6\includes\module.inc on line 471. This is function module_invoke_all.

If I try to create a new ad, I also get the following:

warning: Parameter 2 to ad_image_adapi() expected to be a reference, value given in C:\WebServer\htdocs\drupal6\includes\module.inc on line 450. This function is module_invoke.

I suspected some problem with my PHP settings, so I've set allow_call_time_pass_reference to both on and off, but it makes no difference.

Adding a "&" to the code, like this,

call_user_func_array($function, &$args);

solves the problem. But I'm not sure this is a bug with Drupal itself, or a PHP misconfiguration, or a bad call within the Ads module (sorry in this case.)

Any help is welcome. Thanks!

Comments

damien tournoud’s picture

Project: Drupal core » Advertisement
Version: 6.14 » 6.x-2.x-dev
Component: base system » ad module

module_invoke_all() is not supposed to support passing references. This is a bug in the ads module.

rubs’s picture

I see you've already moved this issue to the ad module. Thanks.

jeremy’s picture

Status: Active » Fixed

The _adapi() was sometimes being called using module_invoke, sometimes using module_invoke_all, and sometimes using a custom invoke function -- the latter allowed node to be passed by reference. In PHP 5.3 a warning was triggered when module_invoke or module_invoke_all were invoking the _adapi() hook.

I have removed all node pass-by-references as it does not appear this functionality was actually being used anywhere anymore. This also removes the special invoke function from the ad module which is no longer necessary.

The commit:
http://drupal.org/cvs?commit=292772

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.