ID: 29547 Updated by: [EMAIL PROTECTED] Reported By: denbraber dot acbjl at avans dot nl Status: Open Bug Type: Math related Operating System: Solaris / nsapi PHP Version: 4.3.8 Assigned To: hholzgra New Comment:
seems to be related to the following addition to config.m4 dnl Solaris 2.8 claims to be 2004 API, but doesn't have dnl ldap_parse_reference() nor ldap_start_tls_s() AC_CHECK_FUNCS([ldap_parse_reference ldap_start_tls_s]) a HAVE_... macro for ldap_start_tls_s was added to config.w32 but it looks as if ldap_parse_reference was overlooked at least according to MSDN windows supports ldap_parse_reference just fine i can't compile and test on windows so i'll add the required patch here for now: --- ext/ldap/config.w32 19 Dec 2003 15:04:21 -0000 1.1 +++ ext/ldap/config.w32 23 Oct 2004 19:42:32 -0000 @@ -12,6 +12,7 @@ CHECK_LIB("olber32.lib", "ldap", PHP_LDAP)) { EXTENSION('ldap', 'ldap.c'); + AC_DEFINE('HAVE_LDAP_PARSE_REFERENCE', 1); AC_DEFINE('HAVE_LDAP_START_TLS_S', 1); AC_DEFINE('HAVE_LDAP', 1); Previous Comments: ------------------------------------------------------------------------ [2004-08-06 14:42:33] denbraber dot acbjl at avans dot nl Description: ------------ When I perform floatingpoint calculations I get really unexpected results. The next three examples should all give 1 as result but they all give 0 as result. echo "floatval \"0.5\"*2=".floatval((2*"0.5"))."<br>"; echo "floatval \"0,5\"*2=".floatval((2*"0,5"))."<br>"; echo "\"0.5\"*2=".(2*"0.5")."<br>"; I found that this could be locale related and so I tried adding just above the previous code: $local=setlocale(LC_ALL,"nld_nld"); echo "<p>Country set to: \"nld_nld\": ".$local."<p>\n"; (or $local=setlocale(LC_NUMERIC,"C"); ) Now when I run the script for the first time after a server start up this will give: Country set to: "nld_nld": Dutch_Netherlands.1252 floatval "0.5"*2=1 "0.5"*2=1 0.5*2=0 Still the last one is incorrect. To make it even weirder, when I hit reload to run the script again it will give: Country set to: "nld_nld": Dutch_Netherlands.1252 floatval "0.5"*2=1 "0.5"*2=1 0.5*2=1 and that is correct!! So every time after a server startup (SunOne webserver with php running as nsapi) I have to run a dummy script to change the locate in order for floatingpoint calculations to be performed correctly in scripts that are run after that. In the past we used older versions of PHP (4.2.x) and those versions did not have this problem. We did run the older versions as CGIBIN under a Netscape Enterprise server but that is not possible anymore with the newer versions so I can't test if it is a result of running PHP as NSAPI now. Is this a know bug and is there a good workaround? Reproduce code: --------------- $local=setlocale(LC_ALL,"nld_nld"); echo "<p>Country set to: \"nld_nld\": ".$local."<p>\n"; echo "floatval \"0.5\"*2=".floatval(2*"0.5")."<br>"; echo "\"0.5\"*2=".(2*"0.5")."<br>"; echo "0.5*2=".(2*0.5)."<br>"; Expected result: ---------------- Country set to: "nld_nld": Dutch_Netherlands.1252 floatval "0.5"*2=1 "0.5"*2=1 0.5*2=1 Actual result: -------------- (without the setlocale:) floatval "0.5"*2=0 "0.5"*2=0 0.5*2=0 or Country set to: "nld_nld": Dutch_Netherlands.1252 floatval "0.5"*2=1 "0.5"*2=1 0.5*2=0 or when teh script is run a secondtime: Country set to: "nld_nld": Dutch_Netherlands.1252 floatval "0.5"*2=1 "0.5"*2=1 0.5*2=1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29547&edit=1