Apply r324744, r326307, r327089 and r327187 to php53 to fix build on -current