Bug #70607 [NEW]: fastcgi_finish_request bug
| From: | machin dot dmitry at gmail dot com | Date: | Wed, 30 Sep 2015 12:04:13 +0000 |
| Subject: | Bug #70607 [NEW]: fastcgi_finish_request bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196311@lists.php.net to get a copy of this message | ||
From: machin dot dmitry at gmail dot com
Operating system: Ubuntu 14.04.3 LTS
PHP version: 7.0.0RC3
Package: FPM related
Bug Type: Bug
Bug description:fastcgi_finish_request bug
Description:
------------
When execute normal and then execute ajax request - after page relaod in
the $_SERVER variable present - HTTP_X_REQUESTED_WITH.
This behavior reproduced only when used fastcgi_finish_request
fucntion.
Test code to check: https://gist.github.com/madmis/313f99b45b23b506a6e6
More details about bug:
http://stackoverflow.com/questions/32847635/php-7-http-x-requested-with-xmlhttprequest-out-of-nowhere
Test script:
---------------
<?php
$requestType = $_SERVER['HTTP_X_REQUESTED_WITH'] ?? 'not ajax';
$html = <<<EOL
<html>
<!-- BEGIN HEAD -->
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1">
<meta name="robots" content="noindex, nofollow" />
<title>HUB - Client List</title>
<script src="//code.jquery.com/jquery-2.1.4.js"></script>
</head>
<body>
<strong>$requestType</strong>
<script>
$(function() {
$.get('index.php?test=test');
});
$(function() {
setTimeout(function() {
// $.get('index.php?test=test');
}, 500);
setTimeout(function() {
// $.get('index.php?test=test');
}, 1500);
});
</script>
</body>
</html>
EOL;
if (!isset($_GET['test'])) {
echo $html;
var_dump($_SERVER);
} else {
echo json_encode(['data' => 'any data']);
}
fastcgi_finish_request();
Expected result:
----------------
not ajax
Actual result:
--------------
XMLHttpRequest
--
Edit bug report at https://bugs.php.net/bug.php?id=70607&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70607&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70607&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70607&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70607&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70607&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70607&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70607&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70607&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70607&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70607&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70607&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70607&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70607&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70607&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70607&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70607&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70607&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70607&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70607&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70607&r=mysqlcfg