Download & Extend

Strict warning: Only variables should be passed by reference in drupalforfirebug_get_php_exec()

Project:Drupal For Firebug
Version:7.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:frob
Status:closed (fixed)

Issue Summary

Hi,

I have installed the latest version 7.x-1.2 and while everything seems to be working well, a php warning is generated on all pages of the site. The warning message is as follows:

Strict warning: Only variables should be passed by reference in drupalforfirebug_get_php_exec() (line 273 of /var/www/sandbox-d7/sites/all/modules/drupalforfirebug/drupalforfirebug.module).

I have looked into the offending script on and around line 273 but could not nail it down. I am somewhat familiar with the conditions that might trigger this warning but was not able to readily see the problem in this code. I am hoping someone can quickly let me know how to make this warning go away.

Thanks

-Reuben

Comments

#1

Hello,

I got the same error on another module I was trying out, and the solution found for it was to split the function into two calls. So in this case, on line 273 in file drupalforfirebug.module I get this:

$output .= drupal_render(drupal_get_form('drupalforfirebug_execute_form'));

and it generates the error mentionned, so I just splitted to get:

$dff_exec_form = drupal_get_form('drupalforfirebug_execute_form');
$output .= drupal_render($dff_exec_form);

and the error is gone... Since I'm new into php coding, I cannot explain why is this so, maybe someone has a better way to solve this.

Hope it helps.

#2

Status:active» needs review

bucketride's suggestion works for me too. I've attached the patch. Thanks.

AttachmentSize
drupalforfirebug.module.patch 579 bytes

#3

Status:needs review» reviewed & tested by the community

Patch applies ok and gets rid of the error message. Thanks! Setting this to reviewed & tested.

drupal_render(&$elements) requires an array passed by reference, whereas drupal_get_form($form_id) returns a literal array from a function call. That might trigger the error message but shouldn't have any other effect.

#4

Hi,

Thanks for the patch. I hope it will be committed soon.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

#5

Assigned to:Anonymous» frob

#6

Status:reviewed & tested by the community» closed (fixed)

This has been rolled into the dev branch, after a few more of these issues are cleared we will roll out a new minor release.

#7

Status:closed (fixed)» fixed

#8

Thanks!

#9

Status:fixed» closed (fixed)

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

#10

For those who are interested, this is a bug in Drupal core handling some stricts incorrectly. The way you fixed it is exactly the suggested way of dealing with it.