Skip to content

update string comparisons possible returns. #1857

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

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions language-snippets.ent
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,15 @@ function.</simpara></warning>'>
</row>
'>

<!ENTITY standard.changelog.binary-safe-string-comparison '<row xmlns="http://docbook.org/ns/docbook">
<entry>8.2.0</entry>
<entry>
This function now returns <literal>-1</literal> or <literal>1</literal>,
where it previously returned a negative or positive number.
</entry>
</row>
'>

<!-- FileInfo -->
<!ENTITY fileinfo.parameters.finfo '<para xmlns="http://docbook.org/ns/docbook">An <classname>finfo</classname> instance, returned by <function>finfo_open</function>.</para>'>
<!ENTITY fileinfo.changelog.finfo-object '<row xmlns="http://docbook.org/ns/docbook">
Expand Down
23 changes: 20 additions & 3 deletions reference/strings/functions/strcasecmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,30 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &lt; 0 if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; &gt; 0 if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and 0 if they are
Returns <literal>-1</literal> if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; <literal>1</literal> if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and <literal>0</literal> if they are
equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
23 changes: 20 additions & 3 deletions reference/strings/functions/strcmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,30 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &lt; 0 if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; &gt; 0 if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and 0 if they are
Returns <literal>-1</literal> if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; <literal>1</literal> if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and <literal>0</literal> if they are
equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
25 changes: 21 additions & 4 deletions reference/strings/functions/strnatcasecmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,30 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Similar to other string comparison functions, this one returns &lt; 0 if
<parameter>string1</parameter> is less than <parameter>string2</parameter> &gt;
0 if <parameter>string1</parameter> is greater than
<parameter>string2</parameter>, and 0 if they are equal.
Similar to other string comparison functions, this one returns <literal>-1</literal> if
<parameter>string1</parameter> is less than <parameter>string2</parameter>
<literal>1</literal> if <parameter>string1</parameter> is greater than
<parameter>string2</parameter>, and <literal>0</literal> if they are equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
25 changes: 21 additions & 4 deletions reference/strings/functions/strnatcmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,30 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Similar to other string comparison functions, this one returns &lt; 0 if
<parameter>string1</parameter> is less than <parameter>string2</parameter>; &gt;
0 if <parameter>string1</parameter> is greater than
<parameter>string2</parameter>, and 0 if they are equal.
Similar to other string comparison functions, this one returns <literal>-1</literal> if
<parameter>string1</parameter> is less than <parameter>string2</parameter>;
<literal>1</literal> if <parameter>string1</parameter> is greater than
<parameter>string2</parameter>, and <literal>0</literal> if they are equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
23 changes: 20 additions & 3 deletions reference/strings/functions/strncasecmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,29 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &lt; 0 if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; &gt; 0 if <parameter>string1</parameter> is
greater than <parameter>string2</parameter>, and 0 if they are equal.
Returns <literal>-1</literal> if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; <literal>1</literal> if <parameter>string1</parameter> is
greater than <parameter>string2</parameter>, and <literal>0</literal> if they are equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
23 changes: 20 additions & 3 deletions reference/strings/functions/strncmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,30 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &lt; 0 if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; &gt; 0 if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and 0 if they are
Returns <literal>-1</literal> if <parameter>string1</parameter> is less than
<parameter>string2</parameter>; <literal>1</literal> if <parameter>string1</parameter>
is greater than <parameter>string2</parameter>, and <literal>0</literal> if they are
equal.
</para>
</refsect1>

<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<para>
Expand Down
7 changes: 4 additions & 3 deletions reference/strings/functions/substr-compare.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &lt; 0 if <parameter>haystack</parameter> from position
<parameter>offset</parameter> is less than <parameter>needle</parameter>, &gt;
0 if it is greater than <parameter>needle</parameter>, and 0 if they are equal.
Returns <literal>-1</literal> if <parameter>haystack</parameter> from position
<parameter>offset</parameter> is less than <parameter>needle</parameter>, <literal>1</literal>
if it is greater than <parameter>needle</parameter>, and <literal>0</literal> if they are equal.
If <parameter>offset</parameter> is equal to (prior to PHP 7.2.18, 7.3.5) or
greater than the length of <parameter>haystack</parameter>, or the
<parameter>length</parameter> is set and is less than 0,
Expand All @@ -102,6 +102,7 @@
</row>
</thead>
<tbody>
&standard.changelog.binary-safe-string-comparison;
<row>
<entry>8.0.0</entry>
<entry>
Expand Down