Bug #81192 [NEW]: "Declaration should be compatible with" gives incorrect line number with traits

From: Date: Tue, 22 Jun 2021 21:44:01 +0000
Subject: Bug #81192 [NEW]: "Declaration should be compatible with" gives incorrect line number with traits
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234593@lists.php.net to get a copy of this message
From: iggyvolz at gmail dot com Operating system: Ubuntu 20.04.2 LTS PHP version: 8.1.0alpha1 Package: *General Issues Bug Type: Bug Bug description:"Declaration should be compatible with" gives incorrect line number with traits Description: ------------ When encountering a "Declaration of x must be compatible with y" error with a function used by a trait, the file number references the class while the line number references the trait. Additionally tested this on PHP 7.4 and the error persists. Test script: --------------- https://gist.github.com/iggyvolz/c1d34e3e0997d9c0b2d9d37512d872ff Expected result: ---------------- Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 5 Or: Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../myTrait.php on line 19 Or: Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 5, from trait on .../myTrait.php on line 19 Actual result: -------------- Fatal error: Declaration of myTrait::foo(): string must be compatible with a::foo(): int in .../b.php on line 19 -- Edit bug report at https://bugs.php.net/bug.php?id=81192&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81192&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81192&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81192&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81192&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81192&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81192&r=support Expected behavior: https://bugs.php.net/fix.php?id=81192&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81192&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81192&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81192&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81192&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81192&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81192&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81192&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81192&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81192&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81192&r=mysqlcfg

« previous php.bugs (#234593) next »