mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
The reason this happens is because the array_unique operation happens in-place because the input array is RC1. At one point during comparison an exception is thrown which will capture the arguments in the backtrace, which will increment the refcount of the RC1 array to 2. Then a modification happens after the throw on the RC2 array causing the assertion failure. We shouldn't try continue work after an exception happened during the sort. Closes GH-20059.
13 lines
310 B
PHP
13 lines
310 B
PHP
--TEST--
|
|
GH-20043 (array_unique assertion failure with RC1 array causing an exception on sort)
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
array_unique([new stdClass, new stdClass], SORT_STRING | SORT_FLAG_CASE);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
Object of class stdClass could not be converted to string
|