Improved exception message while trying to access an attribute from an empty array

Rebased #1439 in master and updated twig extension
hum no problem with the rebase, actually just a wrong ctrl+z... fixed