Details
-
Bug
-
Resolution: Fixed
-
High
-
4.1.0
-
None
-
Operating System: Ubuntu 9.04
PHP Version: 5.2.6
Database and version: MySQL 5.0.75
Browser (and version):
Description
Hello,
When I call the method displayVariable of the class eZTemplateAttributeOperator and the value as_html equals false I have the following error :
Catchable fatal error: Object of class eZContentObjectAttribute could not be converted to string
To correct this, you only have to change two variables :
Line 148 - 163 :
if ( $as_html ) { $spacing = str_repeat( ">", $cur_level ); if ( $show_values ) $txt .= "<tr><td>$spacing$key</td>\n<td>$type</td>\n<td>$itemValue</td>\n</tr>\n"; else $txt .= "<tr><td>$spacing$key</td>\n<td>$type</td>\n</tr>\n"; } else { $spacing = str_repeat( " ", $cur_level*4 ); if ( $show_values ) $txt .= "$spacing$key ($type=$item)\n"; // here, put $itemValue instead of $item else $txt .= "$spacing$key ($type)\n"; }
Line
if ( $as_html ) { $spacing = str_repeat( ">", $cur_level ); if ( $show_values ) $txt .= "<tr><td>$spacing$key</td>\n<td>$type</td>\n<td>$itemValue</td>\n</tr>\n"; else $txt .= "<tr><td>$spacing$key</td>\n<td>$type</td>\n</tr>\n"; } else { $spacing = str_repeat( " ", $cur_level*4 ); if ( $show_values ) $txt .= "$spacing$key ($type=$item)\n"; // here, put $itemValue instead of $item else $txt .= "$spacing$key ($type)\n"; }
I did this and it's ok now.
Steps to reproduce
run this code :
$node = eZContentObjectTreeNode::fetch( /* any node id here */ ); $attributeOp = new eZTemplateAttributeOperator(); $txt = ''; $attributeOp->displayVariable($node, false, true, 2, 0, $txt);