We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Special behavior of Select Element if named "year"

Hi

i found a starange behaviour of Phalcon\Forms\Element\Select

using name "year" i get an error "Object of class DateTime could not be converted to string".

$yearSelect = new \Phalcon\Forms\Element\Select('year',["2015"=>"2015","2016"=>"2016"]);
echo $yearSelect;

Using any other name than "year", the code works as expected.

Bug or undocumented feature?



34.6k
Accepted
answer
edited Sep '15

Are you passing variables from the controller? Using Tag::setDefault ? Maybe they get converted to string causing the exception



3.5k

*doh* ... missing the forrest for the trees ^

my fault, sorry