-
-
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
Fix regression with self-referencing arrays handling #2638
Fix regression with self-referencing arrays handling #2638
Conversation
new tests are always nice, not sure about replacing existing test, especially when you drop some of assertions |
@@ -2441,7 +2441,7 @@ private function registerMockObjectsFromTestArguments(array $testArguments, arra | |||
} | |||
|
|||
$this->registerMockObject($testArgument); | |||
} elseif (is_array($testArgument) && !in_array($testArgument, $visited)) { | |||
} elseif (is_array($testArgument) && !in_array($testArgument, $visited, true)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice fix
@sebastianbergmann , would you consider applying strictness for is_array
globally ?
8e682c9
to
79beff6
Compare
Codecov Report
@@ Coverage Diff @@
## 5.7 #2638 +/- ##
============================================
+ Coverage 52.01% 52.13% +0.11%
Complexity 2907 2907
============================================
Files 110 110
Lines 7761 7761
============================================
+ Hits 4037 4046 +9
+ Misses 3724 3715 -9
Continue to review full report at Codecov.
|
Reverted original test and added mine as a new one. |
tests/Framework/TestCaseTest.php
Outdated
@@ -671,4 +671,20 @@ private function getAutoreferencedArray() | |||
] | |||
]; | |||
} | |||
|
|||
public function testProvidingOfSelfReferencingArray() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between autoreferenced array and selfreferencing one?
no need for testing $arr[] = &$arr
here as well, as it's tested in previous test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed the new test and removed self-reference from the array.
79beff6
to
d91324b
Compare
Thanks! |
thanks @julienfalque , nice fix! |
Fixes a regression introduced with #2620: when arrays mix objects with scalars, it produces errors such as: