-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Infinite recursion when recursive / self-referencing arrays are checked whether they contain only scalar values #5567
Labels
Comments
ptomulik
added
type/bug
Something is broken
version/10
Something affects PHPUnit 10
labels
Nov 19, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 19, 2023
Closed
Anyway, $array = [];
$array['self'] = &$array; the output for the above array is also wrong: 1) ExporterTest::testAnythingThatFailsWithRecursiveArray
Failed asserting that Array &0 [
'self' => Array &1 [
'self' => Array &1,
],
] is false. I'd rather expect just: 1) ExporterTest::testAnythingThatFailsWithRecursiveArray
Failed asserting that Array &0 [
'self' => Array &0,
] is false. But this is actually Exporter's issue. |
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 19, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 19, 2023
Closed
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 19, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 19, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 20, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 20, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 20, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 20, 2023
Hi, is it worth to be work on? I've actually attempted to help with this in #5569, but it was suddenly closed. |
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 30, 2023
ptomulik
added a commit
to ptomulik/phpunit
that referenced
this issue
Nov 30, 2023
Merged
sebastianbergmann
pushed a commit
to ptomulik/phpunit
that referenced
this issue
Dec 4, 2023
sebastianbergmann
pushed a commit
to ptomulik/phpunit
that referenced
this issue
Dec 4, 2023
sebastianbergmann
changed the title
Recursive arrays cause segmentation fault for phpunit >= 10.4
Infinite recursion when recursive / self-referencing arrays are checked whether they contain only scalar values
Dec 4, 2023
sebastianbergmann
pushed a commit
that referenced
this issue
Dec 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Current behavior
Tests such as the following end with segmentation fault when run with PHPUnit >= 10.4:
Here is the run result:
With Xdebug enabled I get this:
How to reproduce
Run a test that is expected to fail and involves a recursive array (see above).
Expected behavior
Shall report failure, as follows (PHPUnit 10.3 does this correctly):
Suggestions
There were changes around
exporter
stuff between PHPUnit 10.3 and 10.4. I guess the root cause of this is the new method PHPUnit\Util\Exporter::isScalarOrArrayOfScalars(). Perhaps it shall use recursion context similarly to all the recursive methods of SebastianBergman\Exporter\Exporter.The text was updated successfully, but these errors were encountered: