Fix segmentation faults with directors in PHP >= 5.4