Skip to content

Infinite loop into out of memory error for class wrongfully extending itself #7787

@FO-nTTaX

Description

@FO-nTTaX

Bug report

When creating a class that extends itself, phpstan will infinitely loop on trying to get the parent class until it is out of memory. I understand this is not valid php code, but I wonder if this might be catch-able and if this could be a normal error with an error message.

Code snippet that reproduces the problem

<?php
class TestClass extends TestClass {}

The share link on phpstan.org does not work because this breaks phpstan pretty badly.

Expected output

This code snippet produces an out of memory error, ideally it should probably create an error message that a class cannot extend itself.

Did PHPStan help you today? Did it make you happy in any way?

phpstan helps me all the time telling me when I made stupid typos, this tool is amazing :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions