From:             dolfi at zkm dot de
Operating system: Mandrake 9.2
PHP version:      Irrelevant
PHP Bug Type:     Strings related
Bug description:  differing behaviour between sscanf/ffscanf

Description:
------------
fscanf on multiline input works differently than sscanf on exactly the
same data presented as a string.

Reproduce code:
---------------
<pre>
<?php
$str = "\n bla \nblup"; $file = "test.txt";
$fd = fopen($file, 'w'); fputs($fd, $str);
fclose($fd);
list($a,$b) = sscanf($str, ' %[a-z] %[a-z] ');
echo "$a;$b;\n";
$fd = fopen($file, 'r');
list($a,$b) = fscanf($fd, ' %[a-z] %[a-z] ');
fclose($fd);
echo "$a;$b;\n";
?>
</pre>


Expected result:
----------------
bla;blup;
bla;blup;


Actual result:
--------------
bla;blup;
;;


-- 
Edit bug report at http://bugs.php.net/?id=28517&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28517&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28517&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28517&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28517&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28517&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28517&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28517&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28517&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28517&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28517&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28517&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28517&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28517&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28517&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28517&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28517&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28517&r=float

Reply via email to