php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2949 setlocale: scanner (scanf?) / printf don't work properly (cont. of bug #722)
Submitted: 1999-12-10 05:53 UTC Modified: 1999-12-10 12:39 UTC
From: php-bug at vogtner dot de Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Beta 3 OS: UNIX
Private report: No CVE-ID: None
 [1999-12-10 05:53 UTC] php-bug at vogtner dot de
The bug is still present in 4.0B3.
This code
<%
      setlocale ('LC_ALL', "de_DE"); // or other locale with dec. sep = ,
      $v = 3;
      $v /= 4;
      print $v;
      echo $v;
     printf ("%7.2f", $v);
	  echo "\n";
	  $z = 3.4;
	  echo $z;
	  echo "\n";
?>

yields:

Connection: close
Content-Type: text/html

0,750,75      0.75
3

the last line should read 3.4.

Additionally: The locale-state seems to be persistent
across two GETs of the respective script. There seems
to be a basic misconception of locales in a high level
language like PHP (Perl seemd to have the same problem
some time ago): You cannot simply call the C-function
setlocale!

Stefan

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-10 12:36 UTC] joey at cvs dot php dot net
Tnaks for the followup!  Fixed in 4.0b4-dev.
Following your example, I get:


0,750,75      0.75
3,4

This is correct, right?

Would it be possible to have you open the 2nd issue as 
it's own bug? I do not understand LOCALES well enough
to know what the issue really is...

Thanks for the report!
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 12:00:02 2026 UTC