Missing visibility check for private abstract trait methods
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
trait T {
public abstract function test();
}
class P {
private function test() {}
}
class C extends P {
use T;
}
This passes without errors. There's an intentional BC layer that skips visibility checks for abstract trait methods (see Zend/tests/traits/abstract_method_4.phpt). However, this should not include private parent methods, because the trait cannot call those. The whole BC layer is questionable today, so it might be better to remove it entirely.
PHP Version
All supported branches
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the example and read Zend/tests/traits/abstract_method_4.phpt, which documents the existing BC behavior for abstract trait methods. Trace the visibility-checking path for a private parent method, then add or adjust a regression test so the intended behavior is explicit and the relevant supported branches pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100