[php-src] Issue #7771: Incorrect file/line blamed for errors caused by `new SomeClass`
| From: | dktapps | Date: | Mon, 13 Dec 2021 20:24:27 +0000 |
| Subject: | [php-src] Issue #7771: Incorrect file/line blamed for errors caused by `new SomeClass` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238381@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7771
Author: dktapps
### Description
https://3v4l.org/UtjRl
This code should blame line 4, not line 7, since that's where the bogus constant is actually
declared.
_____________________________
An example of where this is more problematic:
SomeClass.php
```php
<?php
class SomeClass{
public const INGOT = IDontExist::INGOT;
}
```
test.php
```php
<?php
require 'SomeClass.php';
new SomeClass();
```
Resulted in this output:
```
Fatal error: Uncaught Error: Class "IDontExist" not found in C:\stable\test4.php:5
```
But I expected this output instead:
```
Fatal error: Uncaught Error: Class "IDontExist" not found in C:\stable\SomeClass.php:4
```
This frequently causes issues with my telemetry because incorrect subsystems are getting blamed for
errors when third-party plugin code comes into play.
### PHP Version
8.0.13
### Operating System
Windows (doubtful if relevant)