- Moved NULL check before dereferencing ptr

The change is already in php-src repository.