Skip to content

Commit 7af7c98

Browse files
committed
clarify fscanf/sscanf negative return value
1 parent 3ce71f8 commit 7af7c98

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

reference/filesystem/functions/fscanf.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
than there are available within <parameter>string</parameter>,
6565
&null; will be returned. On other errors, &false; will be returned.
6666
</simpara>
67+
<simpara>
68+
When optional parameters are used and the end of the input
69+
<parameter>string</parameter> is reached before any value has been
70+
parsed, <literal>-1</literal> is returned.
71+
</simpara>
6772
</refsect1>
6873

6974
<refsect1 role="examples">

reference/spl/splfileobject/fscanf.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,21 @@
4040
<refsect1 role="returnvalues">
4141
&reftitle.returnvalues;
4242
<simpara>
43-
If only one parameter is passed to this method, the values parsed will be
43+
If only two parameters were passed to this function, the values parsed will be
4444
returned as an <type>array</type>. Otherwise, if optional parameters are passed,
4545
the function will return the number of assigned values. The optional
4646
parameters must be passed by reference.
4747
</simpara>
48+
<simpara>
49+
If there are more substrings expected in the <parameter>format</parameter>
50+
than there are available within <parameter>string</parameter>,
51+
&null; will be returned. On other errors, &false; will be returned.
52+
</simpara>
53+
<simpara>
54+
When optional parameters are used and the end of the input
55+
<parameter>string</parameter> is reached before any value has been
56+
parsed, <literal>-1</literal> is returned.
57+
</simpara>
4858
</refsect1>
4959

5060
<refsect1 role="examples">

reference/strings/functions/sscanf.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
than there are available within <parameter>string</parameter>,
6464
&null; will be returned.
6565
</simpara>
66+
<simpara>
67+
When optional parameters are used and the end of the input
68+
<parameter>string</parameter> is reached before any value has been
69+
parsed, <literal>-1</literal> is returned.
70+
</simpara>
6671
</refsect1>
6772

6873
<refsect1 role="examples">

0 commit comments

Comments
 (0)