[php-src] Issue #10526: array_unique: Implicit type-casting is performed in spite of the `SORT_REGULAR` flag
| From: | wernerm | Date: | Tue, 07 Feb 2023 09:07:40 +0000 |
| Subject: | [php-src] Issue #10526: array_unique: Implicit type-casting is performed in spite of the `SORT_REGULAR` flag | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243662@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10526
Author: wernerm
### Description
The following code:
```php
<?php
var_dump(array_unique([1, "1"], SORT_REGULAR));
```
Resulted in this output:
```
array(1) {
[0]=>
int(1)
}
```
But I expected this output instead:
```
array(2) {
[0]=>
int(1)
[1]=>
string(2) "1"
}
```
Adding the
SORT_REGULAR flag should result in items being compared normally (not
changing item types).
### PHP Version
PHP 8.0.20
### Operating System
_No response_