I'm using the module with Organic Group and I get the following error:
PHP Fatal error: Only variables can be passed by reference in [..]/pathfilter/pathfilter.module on line 237
It occurs when the module checks $node->og_initial_groups[0] = 269 propriety and all conditions at line 237 evaluated as TRUE:
if (!empty($value[0]['format']) && in_array($value[0]['format'], $defined_formats) &&
!empty($value[0]['value']) && is_string($value[0]['value'])) {
$func_name($value[0]['format'], $value[0]['value']);
}
This happens because a string, in PHP, can be treated as an array of characters and asking for $value[0]['value'] (if $value[0] is 269) means asking for $value[0][0], which is "2": the first character of the string 269.
Now here the funny part: since $defined_formats is
$defined_formats Array [3]
0 (string:1) 1
1 (string:1) 2
2 (string:1) 3
all conditions are evaluated as TRUE, the module executes $func_name($value[0]['format'], $value[0]['value']); passing as second argument the string "2" which cause the fatal error.
To quickly solve the problem is enough to check as first if you are really dealing with an array, so the code would be:
if (is_array($value[0]) && !empty($value[0]['format']) && in_array($value[0]['format'], $defined_formats) &&
!empty($value[0]['value']) && is_string($value[0]['value'])) {
$func_name($value[0]['format'], $value[0]['value']);
}
This is a quick fix, indeed, to go through CCK fields I would use CCK APIs improving also the module's performance.
Bye,
Antonio
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pathfilter-678868.patch | 994 bytes | ademarco |
Comments
Comment #1
ademarco commentedHere a patch for the above mentioned problem.
Comment #2
ademarco commentedA small correction: the bug refers to 6.x-2.x-dev.
Comment #3
joelstein commentedI too am seeing this bug when using Path Filter with Organic Groups. The one-line patch in #1 solved my problem.
Comment #4
mrfelton commentedCommitted. Thanks all.
http://drupal.org/cvs?commit=349646