Smarty 2.6.7 bug in foreach
| From: | Hendy Irawan | Date: | Thu, 24 Feb 2005 03:07:31 +0000 |
| Subject: | Smarty 2.6.7 bug in foreach | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-2645@lists.php.net to get a copy of this message | ||
Hi!
I'm using Smarty 2.6.7 and it seems that it has a "bug". The foreach
built-in function converts the "from" to an array before foreach-ing,
while it works for many cases it doesn't work for objects supporting the
new Iterator interface in PHP 5. This requires change to Smarty compiler
but I think it's quite trivial. You don't need to support Iterator
explicitly, just don't typecast an object to array.
Currently I fixed this by directly changing Smarty compiler and removing
the (array) typecast. Thank you.
Hendy Irawan, GaulDong - http://dev.gauldong.net