Allow to show_source and highlight_file method to highlight a specific line with a different pattern
Description
Allow to show_source and highlight_file method to highlight a specific line with a different pattern.
then when an error occurs I have my custom methods to capture them with:
register_shutdown_function([$this, "shutdownHandler"]);
set_exception_handler([$this, "exceptionHandler"]);
set_error_handler([$this, "errorHandler"]);
at the end knowing I use the path and the file where the error occurred:
$error = error_get_last();
$error['file']; // this is the path of the script where the error occurred!!!
Managed to display the code with:
show_source($error['file'])

but I am interested in highlighting the Line where the error has occurred
I thought that to method how_source or highlight_file, you can pass a second argument with the line or an array of lines to highlight like that:
show_source($error['file'],14);
OR
show_source($error['file'],[1,14]);

Sounds a bit more complicated than what highlight_file and highlight_string were intended to do: be cheap and easy solutions to highlight PHP source. In fact they're already awkward to use because of their reliance on INI settings instead of accepting configuration through a parameter (such as you're suggesting for the line highlighting), and how rudimentary the highlighting is. I personally have rarely seen them used in any serious capacity because there are various libraries out there that can do the same job, for multiple languages, with additional features.
Have you considered that your error page would benefit from a real highlighter? Laravel is a reasonable example of presenting exactly the same sort of error page that you're looking to create, although unfortunately it looks like the library they use is specifically designed for Laravel only.
@damianwadley i am avoid use thirt party librerías... I no need other feature only that i have explained... and i have test symfony and laravel dump...
sounds like you should use https://github.com/filp/whoops instead of re-building it
I seriously doubt that it makes sense to work on the built-in highlight_file|string() functions, since there are better alternatives already mentioned in this ticket. At least, such improvements should go through the RFC process.
If you're interested in this feature please pursue the RFC process. Otherwise this is unlikely to happen. Therefore I'm closing this issue.