php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38681 _SERVER not in UTF-8
Submitted: 2006-09-01 14:31 UTC Modified: 2006-09-01 15:33 UTC
From: bretschneider at cleverbridge dot com Assigned:
Status: Not a bug Package: *Unicode Issues
PHP Version: 5.1.6 OS: Linux 2.6.12-1.1381_FC3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bretschneider at cleverbridge dot com
New email:
PHP Version: OS:

 

 [2006-09-01 14:31 UTC] bretschneider at cleverbridge dot com
Description:
------------
my php.ini:

...
mbstring.func_overload=6;
mbstring.internal_encoding=UTF-8;
mbstring.http_input = auto;
mbstring.detect_order = ISO-8859-1,UTF-8;
mbstring.encoding_translation = On;
...

the internal encoding of php is utf-8. but somehow the $_SERVER vars do not seam to be utf-8 encoded. when you start to build an xml-soap request with including the httpUserAgent you get the following soap-client error.

 Code: Client
        Msg: SOAP-ERROR: Encoding: string 'xxxxxx' is not a valid utf-8 string

using the dom-extension soapClient.

this does not happen if you just put form-variables into the  soap-request.

so i started to debug the difference between a _SERVER var and a _REQUEST var.



Reproduce code:
---------------
Your http useragent name is:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Navegador IE6  de Grupo Cortefiel - T?cnica de Sistemas (c); SV1; .NET CLR 1.1.4322)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
 <form action="utf8.php" method="POST">
  <input type="text" name="browser" size="40" />
 </form>
<pre>
<?php

print $_SERVER['HTTP_USER_AGENT']."\n";
print Strlen($_SERVER['HTTP_USER_AGENT'])."\n";
print strlen($_SERVER['HTTP_USER_AGENT'], 'iso-8859-1')."\n";

if (isset($_REQUEST['browser'])) {
print $_REQUEST['browser']."\n";
print Strlen($_REQUEST['browser'])."\n";
print strlen($_REQUEST['browser'], 'iso-8859-1')."\n";
}
?>
</pre>
</body>
</html>


Expected result:
----------------
_SERVER VAR:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Navegador IE6  de Grupo Cortefiel - T?cnica de Sistemas (c); SV1; .NET CLR 1.1.4322)
135
136

_REQUEST VAR:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Navegador IE6  de Grupo Cortefiel - T?cnica de Sistemas (c); SV1; .NET CLR 1.1.4322)
135
136

Actual result:
--------------
_SERVER VAR:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Navegador IE6  de Grupo Cortefiel - T?cnica de Sistemas (c); SV1; .NET CLR 1.1.4322)
133
135

_REQUEST VAR:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Navegador IE6  de Grupo Cortefiel - T?cnica de Sistemas (c); SV1; .NET CLR 1.1.4322)
135
136

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-01 15:33 UTC] tony2001@php.net
_SERVER variables have nothing to do with mbstring extension, they contain data from external sources, which PHP cannot affect.
Not PHP problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC