Modifications to support PHP5.3