cvs: smarty / NEWS /libs Smarty_Compiler.class.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1111256927@cvsserver> |
messju Sat Mar 19 13:28:47 2005 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty_Compiler.class.php
Log:
objects don't get casted to arrays anymore in {foreach}
http://cvs.php.net/diff.php/smarty/NEWS?r1=1.491&r2=1.492&ty=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.491 smarty/NEWS:1.492
--- smarty/NEWS:1.491 Sat Feb 26 16:18:47 2005
+++ smarty/NEWS Sat Mar 19 13:28:46 2005
@@ -1,3 +1,4 @@
+ - remove cast of object to array in foreach's from-attribute (messju)
- add "null" as a valid token for {if} when security is enabled (messju)
- add javascript_charcode encoding option to mailto function
(monte)
http://cvs.php.net/diff.php/smarty/libs/Smarty_Compiler.class.php?r1=1.363&r2=1.364&ty=u
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.363 smarty/libs/Smarty_Compiler.class.php:1.364
--- smarty/libs/Smarty_Compiler.class.php:1.363 Thu Feb 10 10:14:15 2005
+++ smarty/libs/Smarty_Compiler.class.php Sat Mar 19 13:28:46 2005
@@ -26,7 +26,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.363 2005/02/10 15:14:15 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.364 2005/03/19 18:28:46 messju Exp $ */
/**
* Template compiling class
@@ -1176,14 +1176,15 @@
}
$output = '<?php ';
+ $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }";
if (isset($name)) {
$foreach_props = "\$this->_foreach[$name]";
- $output .= "{$foreach_props} = array('total' => count(\$_from = (array)$from), 'iteration' => 0);\n";
+ $output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n";
$output .= "if ({$foreach_props}['total'] > 0):\n";
$output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
$output .= " {$foreach_props}['iteration']++;\n";
} else {
- $output .= "if (count(\$_from = (array)$from)):\n";
+ $output .= "if (count(\$_from)):\n";
$output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
}
$output .= '?>';
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php