PHP 5.2 compat. Closes #1461