php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62459 [DE] Missing hint for fscanf
Submitted: 2012-07-01 16:47 UTC Modified: 2012-07-06 22:09 UTC
From: roman dot matzutt at rwth-aachen dot de Assigned: nikic (profile)
Status: Closed Package: Translation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2012-07-01 16:47 UTC] roman dot matzutt at rwth-aachen dot de
Description:
------------
---
From manual page: http://www.php.net/function.fscanf#refsect1-function.fscanf-unknown-seealsp
---

In the German version of this documentation it is not mentioned that fscanf only reads one line at a time which causes failure when one wants to scan a (short) file as a whole. For instance, from the German documentation it did not came clear that the code snippet presented below will not work while the English documentation makes clear that this probably will not work.

Test script:
---------------
$file = fopen("filename", "r") or
	die("Could not open file for reading.");
fscanf($file, "%d\n$d", $int1, $int2);
fclose($file);

Expected result:
----------------
That $int1 and $int2 are assigned the integer values from the first or second line of "filename", respectively.

Actual result:
--------------
$int1 is assigned correctly, while $int2 was left undefined. It became 0 due to prior initialization, but leaving out optional parameters and dumping the returned associative array would yield $result['int2'] to equal NULL.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-01 21:25 UTC] nikic@php.net
-Summary: Missing hint for fscanf +Summary: [DE] Missing hint for fscanf -Package: Documentation problem +Package: Translation problem
 [2012-07-06 22:07 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=326508
Log: Fix Doc Bug #62459 [DE] Missing hint for fscanf
 [2012-07-06 22:09 UTC] nikic@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2012-07-06 22:09 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 06:01:31 2024 UTC