Hi Internals,

I've submitted a small PR proposing a new PCRE function that
returns a human-friendly string representation of the last error.

https://github.com/php/php-src/pull/5185

Currently there's only preg_last_error() which returns error codes,
which isn't really helpful. Most comments in the documentation are
about converting those to something more user friendly.

https://www.php.net/preg_last_error#usernotes

Besides, most extensions provide multiple functions for both
use-cases natively, such as:

 - json (json_last_error / json_last_error_msg)
 - socket (socket_last_error / socket_strerror)
 - sqlite (sqlite_last_error / sqlite_error_string)
 - ldap (ldap_errno / ldap_error)
 - etc...

So I think it makes sense for this function to exist.

Any thoughts?

Thank you!

Reply via email to