Upgrade to 4.2.

Tested with 4.2.3, all your example code seems to work as intended.
(Also removed duplicate php requirement)