Skip to content

janedbal/php-bug-complex-inheritance-chain-autoloading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Bug with complex inheritance chain reproduction

  • Affected versions: PHP 8.1.0+

How to reproduce:

php -n ClassPerFile/test.php

# or simplified one-file version
php -n SingleFile/test.php
  • Or using docker:
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:8.5.0RC1-cli-alpine3.22 -n ClassPerFile/test.php # lastest, broken
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:8.1.0-cli -n ClassPerFile/test.php # first broken
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:8.0.30-cli -n ClassPerFile/test.php # last ok

Given output:

| 1: Entrypoint
| | 2: EntrypointParent
| | 2: Child1
| | | 3: Intermediate
| | | | 4: MainParent
| | | | | 5: InterfaceOfMainParent
| | | | | 5: Child2

Fatal error: During inheritance of MainParent, while autoloading Child2: Uncaught Error: Class "Intermediate" not found in /in/G5fFe:31
Stack trace:
#0 /in/G5fFe(22): {closure:/in/G5fFe:7}('Child2')
#1 /in/G5fFe(27): {closure:/in/G5fFe:7}('MainParent')
#2 /in/G5fFe(29): {closure:/in/G5fFe:7}('Intermediate')
#3 /in/G5fFe(39): {closure:/in/G5fFe:7}('Child1')
#4 [internal function]: {closure:/in/G5fFe:7}('Entrypoint')
#5 /in/G5fFe(49): class_exists('Entrypoint')
#6 {main} in /in/G5fFe on line 22

Process exited with code 255.

Reported issue:

About

Reproduction repository of PHP bug with complex inheritance chain and LSP checks

Topics

Resources

Stars

Watchers

Forks

Languages