[php-src] Issue #8243: Allow to show_source and highlight_file method to highlight a specific line with a different pattern

From: Date: Wed, 23 Mar 2022 21:41:51 +0000
Subject: [php-src] Issue #8243: Allow to show_source and highlight_file method to highlight a specific line with a different pattern
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240469@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8243 Author: arcanisgk ### 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: ```php 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: ```php $error = error_get_last(); $error['file']; // this is the path of the script where the error occurred!!! ``` Managed to display the code with: ```php show_source($error['file']) ``` ![image](https://user-images.githubusercontent.com/1207306/159799841-ce7d50f8-9c5d-4636-a302-d48be8773777.png) **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: ```php show_source($error['file'],14); ``` OR ```php show_source($error['file'],[1.14]); ``` ![image](https://user-images.githubusercontent.com/1207306/159800221-a71ebe09-560e-47a6-a1b4-b3956ad326d4.png)

« previous php.bugs (#240469) next »