1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 15:52:15 +01:00

Update exceptions for sprintf, printf, fprintf, vsprintf, fprintf, and vfprintf (#2335)

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Co-authored-by: George Peter Banyard <girgias@php.net>
This commit is contained in:
Daniel
2023-05-09 13:15:05 +02:00
committed by GitHub
parent 72a6f3d35e
commit f134250210
7 changed files with 187 additions and 43 deletions

View File

@@ -3548,13 +3548,6 @@ local: {
</para>
</formalpara>
<note>
<simpara>
Attempting to use a position specifier greater than
<constant>PHP_INT_MAX</constant> will generate warnings.
</simpara>
</note>
<para>
<table>
<title>Specifiers</title>
@@ -3840,6 +3833,142 @@ local: {
</row>
'>
<!ENTITY strings.changelog.sprintf '
<informaltable xmlns="http://docbook.org/ns/docbook">
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if the number of arguments is zero;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if <literal>[width]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if <literal>[precision]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ArgumentCountError</classname> when less arguments are given than required;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
'>
<!ENTITY strings.changelog.vsprintf '
<informaltable xmlns="http://docbook.org/ns/docbook">
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if the number of arguments is zero;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if <literal>[width]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> if <literal>[precision]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Throw a <classname>ValueError</classname> when less arguments are given than required;
previously this function emitted a <constant>E_WARNING</constant> instead.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
'>
<!ENTITY strings.errors.sprintf '
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if the number of arguments is zero.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if <literal>[width]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if <literal>[precision]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ArgumentCountError</classname> is thrown when less arguments are given than required.
Prior to PHP 8.0.0, &false; was returned and a <constant>E_WARNING</constant> emitted instead.
</para>
'>
<!ENTITY strings.errors.vsprintf '
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if the number of arguments is zero.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if <literal>[width]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown if <literal>[precision]</literal> is less than zero or bigger than <constant>PHP_INT_MAX</constant>.
Prior to PHP 8.0.0, a <constant>E_WARNING</constant> was emitted instead.
</para>
<para xmlns="http://docbook.org/ns/docbook">
As of PHP 8.0.0, a <classname>ValueError</classname> is thrown when less arguments are given than required.
Prior to PHP 8.0.0, &false; was returned and a <constant>E_WARNING</constant> emitted instead.
</para>
'>
<!-- filter snippets -->
<!ENTITY filter.param.filter '
<varlistentry xmlns="http://docbook.org/ns/docbook">

View File

@@ -48,6 +48,15 @@
Returns the length of the string written.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.sprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
&strings.changelog.sprintf;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;

View File

@@ -41,6 +41,16 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.sprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
&strings.changelog.sprintf;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View File

@@ -43,26 +43,14 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.sprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
&strings.changelog.sprintf;
</refsect1>
<refsect1 role="examples">

View File

@@ -54,6 +54,16 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.vsprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
&strings.changelog.vsprintf;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>

View File

@@ -46,6 +46,16 @@
Returns the length of the outputted string.
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.vsprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
&strings.changelog.vsprintf;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;

View File

@@ -43,26 +43,14 @@
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
&strings.errors.vsprintf;
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
This function no longer returns &false; on failure.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
&strings.changelog.vsprintf;
</refsect1>
<refsect1 role="examples">