Skip to content

Weak comparison must handle recursion #18585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mvorisek opened this issue May 18, 2025 · 0 comments
Open

Weak comparison must handle recursion #18585

mvorisek opened this issue May 18, 2025 · 0 comments

Comments

@mvorisek
Copy link
Contributor

mvorisek commented May 18, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants