Bug #81683 [NEW]: Misleading "access type ... must be public" interface method error message

From: Date: Wed, 01 Dec 2021 09:50:34 +0000
Subject: Bug #81683 [NEW]: Misleading "access type ... must be public" interface method error message
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238077@lists.php.net to get a copy of this message
From: requinix Operating system: PHP version: 8.1.0 Package: Class/Object related Bug Type: Bug Bug description:Misleading "access type ... must be public" interface method error message Description: ------------ https://github.com/php/php-src/blob/PHP-8.1.0/Zend/zend_compile.c#L7036 When PHP encounters an interface with a method declared non-public, it errors that the "access type for interface method %s must be public" (or "omitted" for <8.1). This is fine. But it also uses that same error message for public methods that include the final or abstract keywords, which is confusing. https://3v4l.org/otUKp Test script: --------------- <?php interface Foo { public abstract function bar(); } ?> Expected result: ---------------- Fatal error: [something about Foo::bar being marked abstract/final] in /in/otUKp on line 4 Actual result: -------------- Fatal error: Access type for interface method Foo::bar() must be public in /in/otUKp on line 4 -- Edit bug report at https://bugs.php.net/bug.php?id=81683&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81683&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81683&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81683&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81683&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81683&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81683&r=support Expected behavior: https://bugs.php.net/fix.php?id=81683&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81683&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81683&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81683&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81683&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81683&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81683&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81683&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81683&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81683&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81683&r=mysqlcfg

« previous php.bugs (#238077) next »