From: samuel at slbdata dot se
Operating system: Ubuntu 8.04.1
PHP version: 6CVS-2008-07-19 (snap)
PHP Bug Type: Strings related
Bug description: Strict comparision on $_SERVER values fail
Description:
------------
Comparing a string in the $_SERVER superglobal using the strict equality
operator (===) always fails, even though both types are strings. $_GET and
other variables work fine.
I'm using the php.ini-recommended file, with no changes except for
display_(startup_)errors which are enabled. My locale is sv_SE.UTF-8 (the
LANG environment variable is set to this value)
This used to work fine in php6.0-200804260630
Reproduce code:
---------------
<?php
$rm = $_SERVER['REQUEST_METHOD'];
echo "Type is: ".gettype($rm)." <br />\n";
if (($rm !== 'GET') && ($rm == 'GET')) {
echo "Bug! <br />\n";
} else {
echo "Correct behaviour! <br />\n";
}
$sp = $_SERVER['SERVER_PROTOCOL'];
echo "Type is: ".gettype($sp)." <br />\n";
if (($sp !== 'HTTP/1.1') && ($sp == 'HTTP/1.1')) {
echo "Bug! <br />\n";
} else {
echo "Correct behaviour! <br />\n";
}
Expected result:
----------------
Type is: string
Correct behaviour!
Type is: string
Correct behaviour!
Actual result:
--------------
Type is: string
Bug!
Type is: string
Bug!
--
Edit bug report at http://bugs.php.net/?id=45566&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45566&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45566&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45566&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45566&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45566&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45566&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45566&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45566&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45566&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45566&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45566&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45566&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45566&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45566&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45566&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45566&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45566&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45566&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45566&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45566&r=mysqlcfg