Skip to content

Missing trait causes fatal error unlike a missing interface or parent class #17959

Closed
@alexpott

Description

@alexpott

Description

The following code:

<?php
class A {
    use MissingTrait;
}

Resulted in this output:

Fatal error: Trait "MissingTrait" not found in /in/QPqKX on line 3

Process exited with code 255.

But I expected this output instead:

Fatal error: Uncaught Error: Trait "MissingTrait" not found in /in/QPqKX on line 3
Stack trace:
#0 {main}
  thrown in /in/bSnmM on line 3

Process exited with code 255.

PHP Version

8.2.0 - 8.2.27, 8.3.0 - 8.3.17, 8.4.1 - 8.4.4

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions