Hi internals,

I noticed a change of behaviour on PHP 8.1:

https://3v4l.org/DoG4A

```
// depth 1
$a = new \stdClass();

// depth 2
$b = new \stdClass();
$b->x = $a;

// depth 3
$c = new \stdClass();
$c->x = [$a];

var_export(json_encode($a, 0, 0)); echo "\n";
var_export(json_encode($b, 0, 1)); echo "\n";
var_export(json_encode($c, 0, 2));
```

On PHP 8.1, all three examples successfully encode the input object, while
on PHP <= 8.0, json_encode() returns false as this exceeds the max depth.

I couldn't find a note about this in the migration guide for PHP 8.1. Is
this documented, or is this a regression that should be fixed?

Thanks in advance,
— Benjamin

Reply via email to