Skip to content

Commit 5e26d11

Browse files
authored
array_unique: explain what the 7.2 rebuild actually changes (#5825)
The 7.2.0 entry mentioned array packing, an engine detail, and left 'different numeric indexes' unexplained. The keys of the returned elements are unchanged; what differs is the index generated when an element is appended afterwards, and only when the element carrying the largest integer key was among the removed duplicates. The 7.2 migration guide carried the same sentence and is updated too.
1 parent 7efe863 commit 5e26d11

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

appendices/migration72/incompatible.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,16 @@ int(2)
269269
<sect2 xml:id="migration72.incompatible.array-unique">
270270
<title><function>array_unique</function> with <constant>SORT_STRING</constant></title>
271271

272-
<para>
273-
While <function>array_unique</function> with <constant>SORT_STRING</constant>
274-
formerly copied the array and removed non-unique elements (without packing
275-
the array afterwards), now a new array is built by adding the
276-
unique elements. This can result in different numeric indexes.
277-
</para>
272+
<simpara>
273+
<function>array_unique</function> with <constant>SORT_STRING</constant>
274+
builds the returned array by adding the unique elements to a new array;
275+
formerly, it was a copy of the input from which the non-unique elements
276+
were removed.
277+
Both hold the same elements under the same keys, but if the element with
278+
the largest integer key is among those removed, the index generated for an
279+
element appended to the returned array differs from the one the input
280+
would have generated.
281+
</simpara>
278282
</sect2>
279283

280284
<sect2 xml:id="migration72.incompatible.bcmod-and-floats">

reference/array/functions/array-unique.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,13 @@
108108
<entry>7.2.0</entry>
109109
<entry>
110110
If <parameter>flags</parameter> is <constant>SORT_STRING</constant>,
111-
formerly <parameter>array</parameter> has been copied and non-unique
112-
elements have been removed (without packing the array afterwards), but
113-
now a new array is built by adding the unique elements. This can result
114-
in different numeric indexes.
111+
the returned array is built by adding the unique elements to a new
112+
array; formerly, it was a copy of <parameter>array</parameter> from
113+
which the non-unique elements were removed.
114+
Both hold the same elements under the same keys, but if the element
115+
with the largest integer key is among those removed, the index
116+
generated for an element appended to the returned array differs from
117+
the one <parameter>array</parameter> would have generated.
115118
</entry>
116119
</row>
117120
</tbody>

0 commit comments

Comments
 (0)