[1.2.2] [CRASH] Fix segmentation fault in zend_std_write_property for PHP 5.4+

See #1000

This is #1003 backported to 1.2.2