Fix compilation errors for PHP 5.2