Bug #70607 [Opn->Csd]: fastcgi_finish_request bug
Edit report at https://bugs.php.net/bug.php?id=70607&edit=1
ID: 70607
User updated by: machin dot dmitry at gmail dot com
Reported by: machin dot dmitry at gmail dot com
Summary: fastcgi_finish_request bug
-Status: Open
+Status: Closed
Type: Bug
Package: FPM related
Operating System: Ubuntu 14.04.3 LTS
PHP Version: 7.0.0RC3
Block user comment: N
Private report: N
New Comment:
fixed
Previous Comments:
------------------------------------------------------------------------
[2015-09-30 12:49:28] machin dot dmitry at gmail dot com
A havn't access to this page - http://snaps.php.net/php-trunk-latest.tar.gz.
But as i understand - fixed in RC4.
I will try to check it.
Thank you.
------------------------------------------------------------------------
[2015-09-30 12:28:12] laruence@php.net
Please try using this snapshot:
http://snaps.php.net/php-trunk-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
it should already be fixed , see #70279
------------------------------------------------------------------------
[2015-09-30 12:04:12] machin dot dmitry at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=70607&edit=1
Thread (4 messages)