Skip to content

Weak comparison must handle recursion #18585

Open
@mvorisek

Description

@mvorisek

Description

The following code:

<?php

class Node {
    public $next;
}

$first = new Node();
$first->next = $first;

$new = new Node();
$new->next = $new;

var_dump($first == $new);

Resulted in this output:

Fatal error: Nesting level too deep - recursive dependency? in /in/qWtA7 on line 13

But I expected this output instead:

bool(true)

online repro: https://3v4l.org/AZV6v and https://3v4l.org/SttGY

The issue is present also for other "weak comparison operators" like <.

PHP Version

any

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