php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59146 Wrong return value of HttpMessage::getHttpVersion()
Submitted: 2010-04-05 17:51 UTC Modified: 2010-04-28 02:39 UTC
From: jan at horde dot org Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.3.2RC3 OS: Linux
Private report: No CVE-ID: None
 [2010-04-05 17:51 UTC] jan at horde dot org
Description:
------------
HttpMessage::getHttpVersion() returns a string instead a float. This would be fine, if the string was actually a string representation of the version float. But the string is locale dependent.
The method should either return a float, or cast to string locale-independently.

Reproduce code:
---------------
setlocale(LC_ALL, "de_DE");
$h = new HttpRequest("http://www.example.com");
$h->send();
echo $h->getResponseMessage()->getHttpVersion();

Expected result:
----------------
1.1

Actual result:
--------------
1,1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-27 09:45 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug.

This is PHP's behaviour and not pecl_http's.

As you set the locale to de_DE (where decimal separator is a comma) PHP prints the returned float as "1,1".

Use number_format() to display decimal values as you desire or do not use POSIX locales.
 [2010-04-27 09:47 UTC] mike@php.net
Dammit, I actually should read the bug report thouroughly.

Sorry.
 [2010-04-28 02:39 UTC] mike@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 26 02:03:38 2021 UTC