[core,legacy] fix @6403aef Fatal error on PHP<5.3