Fix memory allocation error (only on PHP >= 5.4).