From: erwin dot derksen at zonnet dot nl Operating system: Windows Vista PHP version: 5.2.8 PHP Bug Type: Strings related Bug description: Bad scan conversion character "F" (non-locale aware scanning not possible)
Description: ------------ According to the documentation the format string is interpreted as described in the documentation for sprintf. However, function testSscanf() issues a warning 'Bad scan conversion character "F"'. On further examination, it is not just a documentation error but an error in sscanf, see function testSscanf2() Note that the dutch locale (nld) formats the decimal point as comma (,) and the thousand separator as a point (.). Reproduce code: --------------- function testSscanf() { $f = null; $s = sprintf("%F", 1.34); $r = sscanf($s, "%F", $f); echo $f; } function testSscanf2() { setlocale(LC_ALL, "nld"); $f = 1.34; $s1 = sprintf("%f", $f); $s2 = sprintf("%F", $f); sscanf($s1, "%f", $f1); sscanf($s2, "%f", $f2); sscanf($s1, "%F", $f3); sscanf($s2, "%F", $f4); echo 's1 = ' . $s1 . "<br/>\n"; echo 's2 = ' . $s2 . "<br/>\n"; echo 'f = ' . $f . "<br/>\n"; echo 'f1 = ' . $f1 . " (%f scanned from %f printed)<br/>\n"; echo 'f2 = ' . $f2 . " (%f scanned from %F printed)<br/>\n"; echo 'f3 = ' . $f3 . " (%F scanned from %f printed)<br/>\n"; echo 'f4 = ' . $f4 . " (%F scanned from %F printed)<br/>\n"; } Expected result: ---------------- 1,34 1 1 1.34 Actual result: -------------- s1 = 1,340000 s2 = 1.340000 f = 1,34 f1 = 1 (%f scanned from %f printed) f2 = 1,34 (%f scanned from %F printed) f3 = (%F scanned from %f printed) f4 = (%F scanned from %F printed) -- Edit bug report at http://bugs.php.net/?id=47489&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47489&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47489&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47489&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47489&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47489&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47489&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47489&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47489&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47489&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47489&r=support Expected behavior: http://bugs.php.net/fix.php?id=47489&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47489&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47489&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47489&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47489&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47489&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47489&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47489&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47489&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47489&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47489&r=mysqlcfg