[php-src] Issue #22354: zend_compile_implements() assumes that the class entry has no interfaces already
| From: | DanielEScherzer | Date: | Wed, 17 Jun 2026 17:44:16 +0000 |
| Subject: | [php-src] Issue #22354: zend_compile_implements() assumes that the class entry has no interfaces already | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252211@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/22354
Author: DanielEScherzer
### Description
See https://github.com/php/php-src/blob/b0c78657949289c87d36eda5385d032294c40118/Zend/zend_compile.c#L8959-L8977
If an attribute validator added an interface to the class, it gets silently dropped and triggers
leaks, because class attributes are compiled before implements, see
https://github.com/php/php-src/blob/b0c78657949289c87d36eda5385d032294c40118/Zend/zend_compile.c#L9110-L9116
Discovered while working on https://github.com/DanielEScherzer/CustomCast,
not sure if I noticed this earlier and just didn't report it but it has been there for a while
### PHP Version
```plain
8.4+
```
### Operating System
_No response_