It seems the current version of PHPTemplate in CVS is incompatible with PHP 5. The theme will not render as a result of this error. From the logs we can see the following errors:
[Fri Jan 6 02:21:16 2006] [error] PHP Warning: array_merge() [<a href='function.array-merge'>function.array-merge</a>]: Argument #2 is not an array in <omitted path>/themes/engines/phptemplate/phptemplate.engine on line 60
[Fri Jan 6 02:21:16 2006] [error] PHP Warning: extract() [<a href='function.extract'>function.extract</a>]: First argument should be an array in <omitted path>/themes/engines/phptemplate/phptemplate.engine on line 334
I checked out an older version of the code it references (which *is* working).
Working Version:
if (function_exists('_phptemplate_variables')) {
$ret = _phptemplate_variables($hook, $variables);
if(is_array($ret))
{
$variables = array_merge($variables, $ret);
}
}
Non-working version:
if (function_exists('_phptemplate_variables')) {
$variables = array_merge($variables, _phptemplate_variables($hook, $variables));
}
I could submit a patch for this but I'm honestly not sure what the "correct" coding convention is here. Is the working code above acceptable from a style standpoint? If so I'll correct it and submit a patch.
Comments
Comment #1
rbrooks00 commentedeh... just decided to submit the patch anyway with the older (working) code. If it needs style tweaks please let me know.
Comment #2
dries commentedIt think this might require a different fix. We should probably fix _phptemplate_variables() to always return an array.
Comment #3
rbrooks00 commentedI could be wrong but I think the issue is that the array_merge function doesn't recognize "_phptemplate_variables($hook, $variables)" as an array even though that is what it returns. I've seen things cast as an array before to fix this problem, but I'm not sure if that'd apply here. E.g.
But I'm not sure if that would work in this case, I've only seen it done to variables.
Comment #4
m3avrck commentedI'm running latest 4.7 CVS with PHP 5.1.2 and I can't reproduce this at all.
It seems to me that this is being caused by a specific theme that is overriding _phptemplate_variables() and *not* returning an array like it should.
Try upgrading to the latest beta/CVS and use the default themes, there should not be a problem. I've even tried overriding _phptemplate_variables() to return some with no problem either.
Marking this 'closed'.