Bug #64891 [NEW]: POST values in Google Chrome XHR.
| From: | marc at kryn dot org | Date: | Tue, 21 May 2013 21:24:06 +0000 |
| Subject: | Bug #64891 [NEW]: POST values in Google Chrome XHR. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-179053@lists.php.net to get a copy of this message | ||
From: marc at kryn dot org
Operating system: OS X 10.8.2
PHP version: 5.4.15
Package: Built-in web server
Bug Type: Bug
Bug description:POST values in Google Chrome XHR.
Description:
------------
The PHP file servered through the built-int web server does not receive
somehow
the POST values from a AJAX/XHR POST call in Google Chrome. Only in Google
Chrome.
Setup:
- Create the file from the test script.
- Open a built-in web server
php54 -S 127.0.0.1:8000 -t web/
- Open the file http://127.0.0.1:8000/test.php`
This behaviour happens only for the built-in web server and Google Chrome.
It
works fine when running PHP behind fpm or as apache module. Any other
browser
works in all combinations (built-in server or not).
Tested on 5.4.15-1 installed through mac ports.
Test script:
---------------
<?php
if (isset($_GET['test'])) {
echo 'received values: <br/>';
var_dump($_POST);
exit;
}
?>
<div id="response"></div>
<script>
var xhr = new XMLHttpRequest();
xhr.open('POST', '<?= $_SERVER['SCRIPT_NAME'] ?>?test=1', true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.onload = function(){ document.getElementById('response').innerHTML =
this.responseText; };
xhr.send('foo=bar');
</script>
Expected result:
----------------
received values:
array (size=1)
'foo' => string 'bar' (length=3)
Actual result:
--------------
received values:
array (size=0)
empty
--
Edit bug report at https://bugs.php.net/bug.php?id=64891&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64891&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64891&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64891&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64891&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64891&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64891&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64891&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64891&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64891&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64891&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64891&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64891&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64891&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64891&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64891&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64891&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64891&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64891&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64891&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64891&r=mysqlcfg