URL-Parser icon indicating copy to clipboard operation
URL-Parser copied to clipboard

Do you want to be notified when the parser encounters a validation error?

Open TRowbotham opened this issue 7 years ago • 2 comments

Basically, there are 3 questions here:

  1. Do you want to be notified when the parser encounters a validation error?
  2. Should there be a way to enable and disable validation error reporting?
  3. What would be the best way to convey the error information?

There are roughly 60 different places in the parser that currently call for a validation error to be reported. As far as I can tell, I have 3 options for reporting the error. I can use error_log(), trigger_error(), or I can push each error onto an array that can then be retrieved through a method added to the URL class. I am, of course, open to other ideas.

TRowbotham avatar Jul 27 '18 21:07 TRowbotham

@TRowbotham Why not use some a PSR-3 logging implementation ? That way any user can easily format or aggregate error logging from his/her app in a simple and standardize way 🤔

Also kudos for your URL parser I always wanted to tackle WHATWG URL parsing algorithm and you seem to have done it quite right 👍

nyamsprod avatar Nov 26 '18 13:11 nyamsprod

I'm glad you find it useful.

I agree, a PSR-3 implementation would be best.

TRowbotham avatar Nov 26 '18 20:11 TRowbotham

Validation error logging was added in the 4.0 release

TRowbotham avatar Jun 21 '24 02:06 TRowbotham