#40529 [NEW]: invalid SimpleXMLElement forces HTTP 200 header
| From: | PK at eBrain dot nl | Date: | Sat, 17 Feb 2007 23:17:07 +0000 |
| Subject: | #40529 [NEW]: invalid SimpleXMLElement forces HTTP 200 header | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-109067@lists.php.net to get a copy of this message | ||
From: PK at eBrain dot nl
Operating system: Fedore Core 3
PHP version: 5.2.1
PHP Bug Type: SimpleXML related
Bug description: invalid SimpleXMLElement forces HTTP 200 header
Description:
------------
When SimpleXMLElement in run on something invalid or empty, the HTTP
status code is forced to 200 and can not be influenced later on. Either
this is a bug or expected behavior - in the last case, it should be:
documented on http://nl2.php.net/simplexml/ + explained
how to work around
it.
Note: my actual PHP version is: 5.0.4
Reproduce code:
---------------
Note: php://input is empty (i.e. a direct request to the page).
$PostXML = new SimpleXMLElement('php://input');
if (empty($PostXML))
{
header('HTTP/1.1 400 Bad Request');
}
else
{
header('HTTP/1.1 202 Accepted');
}
Expected result:
----------------
HTTP Status Code: HTTP/1.1 400
Actual result:
--------------
HTTP Status Code: HTTP/1.1 200
--
Edit bug report at http://bugs.php.net/?id=40529&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40529&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40529&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40529&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40529&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40529&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40529&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40529&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40529&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40529&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40529&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40529&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40529&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40529&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40529&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40529&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40529&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40529&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40529&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40529&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40529&r=mysqlcfg