Bug #12337 Updated: Function fscanf does not correctly handle "\t" in format string

From: Date: Sun, 09 Jun 2002 21:50:18 +0000
Subject: Bug #12337 Updated: Function fscanf does not correctly handle "\t" in format string
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-9955@lists.php.net to get a copy of this message
ID: 12337 Updated by: mfischer@php.net Reported By: premysl.dedic@conquest.cz -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux RedHat 6.2 PHP Version: 4.0.4pl1 New Comment: This bug has been fixed in CVS. You can grab a snapshot of the CVS version at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2002-02-10 19:27:33] elixer@php.net Whitespace characters (be they space, tab, or newline, etc.) in the format string matche one or more whitespace characters in the input. So the second \t in your format string is matching the space between 'def' and 'ghi.' The sample file from the documentation does not include "embedded whitespace" in the different data columns as yours does. I'm changing this to a documentation problem because the (f)scanf documentation is really lacking. Sean ------------------------------------------------------------------------ [2001-07-24 09:45:17] premysl.dedic@conquest.cz When I copy&paste sample from documentation of fscanf function, I found, that it work incorrectly: Sample: while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) { list ($name, $profession, $countrycode) = $userinfo; } Sample file: abc<tab>def ghi jkl<tab> ..... <newline> Note: <tab> means here a "tabelator" character (\t) Result: $name = 'abc' $profession = 'def'; $contrycode = 'jkl'; I expect: $name = 'abc' $profession = 'def ghi jkl'; $contrycode = ' .... '; What si wrong??? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=12337&edit=1

« previous php.bugs (#9955) next »