Various php5.4 fixes