php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #722 setlocale: scanner (scanf?) / printf don't work properly
Submitted: 1998-09-04 07:33 UTC Modified: 1999-12-09 19:29 UTC
From: vogtner at soldan dot de Assigned: jaakko (profile)
Status: Closed Package: Misbehaving function
PHP Version: 3.0.3 OS: Unix
Private report: No CVE-ID: None
 [1998-09-04 07:33 UTC] vogtner at soldan dot de
<?
	setlocale (LC_ALL, "de_DE"); // or other locale with dec. sep = ,
	$v = 3;
	$v /= 4;
	print $v;
	echo $v;
	printf ("%7.2f", $v);
?>
If built as apache module, set locale is set global. Successive calls
to print and echo work under the current locale. Printf is never affected
by the locale setting.
After setting the locale code like
	$v = 3.4;
is no longer parsed correctly. 
	$v = 3,4;
is rejected as syntax error. The syntax says "." is the decimal separator, but actually "," is used. Only
	$v = "3,4";
works OK.
I think that calling the C-function setlocale from within php's code is not the right way to provide locales.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-12 10:43 UTC] joey at cvs dot php dot net
3.0.3?!? Wow! That's when I first started using PHP! Can anyone verify whether this is still there?
(I'm not using locales...)
 [1999-12-09 19:25 UTC] joey at cvs dot php dot net
Closing due to lack of info
 [1999-12-09 19:29 UTC] joey at cvs dot php dot net
Opps, forgot to close it! ;)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 03:01:35 2025 UTC