php_error_docref
Added -1 safety check, fixed test