Bug #81192 [Ver->Csd]: "Declaration should be compatible with" gives incorrect line number with traits

From: Date: Thu, 12 Aug 2021 12:36:00 +0000
Subject: Bug #81192 [Ver->Csd]: "Declaration should be compatible with" gives incorrect line number with traits
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235792@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81192&edit=1 ID: 81192 Updated by: git@php.net Reported by: iggyvolz at gmail dot com Summary: "Declaration should be compatible with" gives incorrect line number with traits -Status: Verified +Status: Closed Type: Bug Package: *General Issues Operating System: Ubuntu 20.04.2 LTS PHP Version: 8.1.0alpha1 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: https://github.com/php/php-src/commit/1c6df2dffda301f6c458bd291eb2f4bf12906dd9 Log: Fixed bug #81192 Previous Comments: ------------------------------------------------------------------------ [2021-06-22 21:44:01] iggyvolz at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81192&edit=1

« previous php.bugs (#235792) next »