Hi, I upgraded my server to PHP 5.3.2, and I have this message:

"warning: Parameter 2 to ad_flash_adapi() expected to be a reference "...

I search in drupal forum and I find this:
http://drupal.org/node/728486

So the solution is to remove the "&" character at the line 211 of your ad_flash.module
and it's work!!

Can you port this correction on the next release?

Thanks.

CommentFileSizeAuthor
#4 ad_flash-php53.diff350 bytesjohn franklin

Comments

zoo33’s picture

That would remove the error messages, but I'm not sure it's the whole solution, since ad_flash_adapi() seems to expect to be able to alter the passed $node object:

unset($node->files);

The _adapi hook gets invoked in ad.module:

module_invoke("ad_{$node->adtype}", adapi, $op, $node);

module_invoke() doesn't support arguments as references, which makes ad_flash_adapi()'s changes to $node futile if I understand correctly. The error messages introduced in php 5.3 only puts the finger on an existing problem. So with that in mind, the change suggested by kobee shouldn't introduce any new problems.

Question is, can ad_flash_adapi() do without altering the $node object? I think that's a question for the module author. If not, ad.module has to be modified to invoke this hook in a way that supports references, similar to how node_invoke_nodeapi() does it.

Alex Andrascu’s picture

Status: Active » Patch (to be ported)

Thanks for the solution. It's been awhile since i haven't updated this module. I'm looking to do a cummulative update this month tough.
Thanks again.

ionmedia’s picture

i changed line 211
function ad_flash_adapi($op, &$node) {
to
function ad_flash_adapi($op, $node) {
error disappear, is this correct fix of this issue ?

john franklin’s picture

StatusFileSize
new350 bytes

That fixes it for me. $node is an object, and objects are (effectively) passed by reference. Patch attached that accomplishes #3.

kurkuma’s picture

span’s picture

Works for me.

osopolar’s picture

The hook ad_flash_adapi is sometimes its called directly, where a reference may be ok, but sometimes with module_invoke which can't pass arguments by reference.

See also drupal API module_invoke.

Looking on all other implementations of hook_adapi the arguments never will be passed by reference, so it shouldn't be done here neither.

kenorb’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.