php / php/php-src

zend_compile_implements() assumes that the class entry has no interfaces already

Open
#22,354 0 comments 1 reaction 1 assignee View on GitHub

@DanielEScherzer is already working on this.

Since Jun 17, 2026.

  • #22355 by @DanielEScherzer — open
Bug Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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
8.4+
Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.