Expected Reference, Value Given

Grayside - October 12, 2009 - 18:45
Project:Vertical Tabs
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Dave Reid
Status:closed
Description

After upgrading to PHP 5.3, I get the following message on node/edit:
warning: Parameter 1 to theme_vertical_tabs() expected to be a reference, value given in /home/drupal/drupal-6.14/includes/theme.inc on line 617.

This complete breaks the display functionality of Vertical Tabs. When I fix the expected reference, all is well.

AttachmentSize
expected_reference_value_given.patch567 bytes

#1

kiamlaluno - October 25, 2009 - 23:36
Version:6.x-1.0-beta4» 6.x-1.x-dev

I can confirm the patch works.

I am not sure why the parameter is declared to be passed by reference, when the parameter is not modified.

<?php
/**
* After build function to add vertical tabs JS and CSS to the form.
*/
function theme_vertical_tabs(&$form_element) {
 
// Add Vertical Tabs JS and CSS.
 
theme('vertical_tabs_js_css', $form_element['#vertical_tabs_js'], $form_element['#vertical_tabs_css'], $form_element['#vertical_tabs_settings'], $form_element['#form_id']);

  return
'<div class="'. $form_element['#attributes']['class'] .'">&nbsp;</div>';
}
?>

#2

thekevinday - October 26, 2009 - 18:08

I agree with this patch and it does solve my problem.

With the drupal php 5.3 patches, the theme function now calls:

$output = call_user_func_array($info['function'], $args);

where it used to call

$output = call_user_func_array($info['function'], &$args);

Looking at the vertical_tabs code, the theme_vertical_tabs function still has its parameters passed by reference.

Looking into the vertical tab theme function, it does not seem to make any writes to the argument that is passed by reference.
Therefore, the above patch should be safe to apply for php-5.3 systems.

There is a problem with php 4.
The same exact issues are discussed here in the views project::
http://drupal.org/node/452384

This specific thread mentions the php 4 compatibility issue:
http://drupal.org/node/452384#comment-2097968

#3

Dave Reid - November 6, 2009 - 20:33
Assigned to:Anonymous» Dave Reid

#4

Dave Reid - November 6, 2009 - 23:05
Status:needs review» fixed

Fixed in CVS (http://drupal.org/cvs?commit=285290). Thanks!

#5

System Message - November 20, 2009 - 23:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.