fabpot/Twig — Issue #463: Casting key from float to int in Twig_Template::getAttribute()
Author: dkarlovi
Created: 2011-10-11 09:59:35+00:00
State: open

When doing a bit of math on (numeric) keys before trying to access them as values, we get:

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /data/html/webs/rtl.hr/trunk/lib/Twig/Template.php on line 304

The reason is that array_key_exists() will not allow for float, but $array[$float] still works (by casting to int) so a reasonable thing to do is to cast to int here too.

More here:
https://github.com/fabpot/Twig/commit/f742efd602f310c37fdbe40c5ffcf4d61f5a4f52#lib/Twig/Template.php-P24