From 00f461c9aaaa6844d9add3a687a6b601f0ba7080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:10:32 +0100 Subject: [PATCH 1/4] Add note about SORT_REGULAR + numeric strings bug to array_unique() As suggested in https://github.com/php/php-src/issues/20262#issuecomment-3445270671 --- reference/array/functions/array-unique.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reference/array/functions/array-unique.xml b/reference/array/functions/array-unique.xml index 88a79d128721..db3ee4df989d 100644 --- a/reference/array/functions/array-unique.xml +++ b/reference/array/functions/array-unique.xml @@ -54,8 +54,17 @@ Comparison type flags: - SORT_REGULAR - compare items normally - (don't change types) + + SORT_REGULAR - compare items normally + (don't change types) + + + Be careful when using this flag in combination with numeric strings + as array values since this causes them to not be filtered out + correctly. + + + SORT_NUMERIC - compare items numerically From e3aaa50accd1c9914847d8dfdc4e4c7ba119f37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:12:32 +0100 Subject: [PATCH 2/4] Fix indention --- reference/array/functions/array-unique.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/array/functions/array-unique.xml b/reference/array/functions/array-unique.xml index db3ee4df989d..6901e4281b6d 100644 --- a/reference/array/functions/array-unique.xml +++ b/reference/array/functions/array-unique.xml @@ -57,13 +57,13 @@ SORT_REGULAR - compare items normally (don't change types) - - - Be careful when using this flag in combination with numeric strings - as array values since this causes them to not be filtered out - correctly. - - + + + Be careful when using this flag in combination with numeric strings + as array values since this causes them to not be filtered out + correctly. + + From 534eb811beeb3991cdbd4b970a3ffd5cd8a729aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:18:45 +0100 Subject: [PATCH 3/4] Use instead of --- reference/array/functions/array-unique.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/array/functions/array-unique.xml b/reference/array/functions/array-unique.xml index 6901e4281b6d..5b0b3093df80 100644 --- a/reference/array/functions/array-unique.xml +++ b/reference/array/functions/array-unique.xml @@ -54,7 +54,7 @@ Comparison type flags: - + SORT_REGULAR - compare items normally (don't change types) @@ -64,7 +64,7 @@ correctly. - + SORT_NUMERIC - compare items numerically From 3f5105113e411cba0781fb4f7ecf8d19741486db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=A4drich?= <11225821+shaedrich@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:09:12 +0100 Subject: [PATCH 4/4] Make text more precise --- reference/array/functions/array-unique.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/array/functions/array-unique.xml b/reference/array/functions/array-unique.xml index 5b0b3093df80..ff52b00eb520 100644 --- a/reference/array/functions/array-unique.xml +++ b/reference/array/functions/array-unique.xml @@ -61,7 +61,7 @@ Be careful when using this flag in combination with numeric strings as array values since this causes them to not be filtered out - correctly. + correctly and you end up with duplicated values.