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

CommentFileSizeAuthor
#1 pathfilter-678868.patch994 bytesademarco

Comments

ademarco’s picture

StatusFileSize
new994 bytes

Here a patch for the above mentioned problem.

ademarco’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

A small correction: the bug refers to 6.x-2.x-dev.

joelstein’s picture

I too am seeing this bug when using Path Filter with Organic Groups. The one-line patch in #1 solved my problem.

mrfelton’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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