Closed (fixed)
Project:
Link
Version:
5.x-1.5
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2007 at 09:57 UTC
Updated:
21 Oct 2007 at 06:17 UTC
There is a problem with the Link module if you use PHP 5. The unset function is not supported for referenced arrays anymore, and this trigger an error on my site. On line 272 I have to uncomment the following line to make it work:
unset($node_field['attributes']['target']);
This should be fixed, but I can't see how without changing more functions.
Comments
Comment #1
gracearoha commentedjust tracking
Comment #2
quicksketchI don't believe this is the case. I've used unset all over the place where object and array values are passes by reference. The arrays and objects themselves passed by reference cannot be unset, but their individual keys may be unset just fine. For example:
function myfunction(&$my_array) {
unset($my_array); // Does not affect original referenced variable
unset($my_array['my_key']); // Removes 'my_key' from the original variable
}
This comment on the PHP site gives the same explanation: http://us2.php.net/manual/en/function.unset.php#56661
Drupal core uses this in several places also. Most notably I found it in common.inc as part of drupal_render (look for
unset($elements['#prefix'], $elements['#suffix']);after $elements is passed in by reference).Comment #3
quicksketch