_phptemplate_default doesn't check that parameters passed in by declarations in template.php are arrays

juanfe - July 18, 2007 - 23:47
Project:PHPTemplate
Version:HEAD
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

Declare the following in template.php

phptemplate_hooktotheme() {
_phptemplate_callback('my_tplfile', $vars, 'suggested_tpl');
}

You'll receive a host of php warnings regarding foreach() receiving a non-array. While it should be standard practice for template coders to pass in arrays when they should and pass in variables when they should, perhaps relying on that may not be the most desirable thing. A sanity check to make sure that values passed in are what you expect them to be would be ideal -- something as simple as a cast into array within _phptemplate_callback() or checking with is_array() before handling might do the trick.

 
 

Drupal is a registered trademark of Dries Buytaert.