[php-src] Issue #8243: Allow to show_source and highlight_file method to highlight a specific line with a different pattern
| From: | arcanisgk | 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'])
```

**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]);
```
