Fix issue #2681 should be compitable with php from 4 & up.