From: bretschneider at cleverbridge dot com
Operating system: Linux 2.6.12-1.1381_FC3
PHP version: 5.1.6
PHP Bug Type: *Unicode Issues
Bug description: _SERVER not in UTF-8
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
--
Edit bug report at http://bugs.php.net/?id=38681&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38681&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38681&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38681&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38681&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38681&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38681&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38681&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38681&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38681&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38681&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38681&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38681&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38681&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38681&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38681&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38681&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38681&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38681&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38681&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38681&r=mysqlcfg