Bug #74158 [NEW]: closes connection abruptly
| From: | teo8976 at gmail dot com | Date: | Thu, 23 Feb 2017 22:46:17 +0000 |
| Subject: | Bug #74158 [NEW]: closes connection abruptly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-207527@lists.php.net to get a copy of this message | ||
From: teo8976 at gmail dot com
Operating system: linux
PHP version: 5.6.30
Package: Apache2 related
Bug Type: Bug
Bug description:closes connection abruptly
Description:
------------
I do a curl to an url that runs a script on my server:
curl 'https://www.mydomain.com' -H
'accept-encoding: gzip, deflate,
sdch, br' -H 'accept-language:
en-US,en;q=0.8,ca;q=0.6,es;q=0.4,it;q=0.2,fr;q=0.2,pt;q=0.2,de;q=0.2' -H
'upgrade-insecure-requests: 1' -H 'authorization: Basic XXXXXXXX' -H
'accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
-H 'cache-control: max-age=0' -H 'authority: www.mydomain.com' -H
'cookie: [.....]' -H 'referer: https://www.mydomain.com/whatever' -H
'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/56.0.2924.87 Safari/537.36' --compressed
And I get:
* GnuTLS recv error (-110): The TLS connection was non-properly
terminated.
* Closing connection 0
before any header (or anything for that matter) is received.
The request is not even logged into Apache's access log on the server,
nor any error logged to error_log.
No matter what my PHP code does and how huge an error it may contain,
that is NEVER, EVER an acceptable outcome.
I have figured out that the error is somehow triggered by this
function:
function fetch_product_dependencies($productid, &$dependency_list)
{
if (!is_array($dependency_list["$productid"]))
{
return array();
}
$list = array();
foreach ($dependency_list["$productid"] AS $subproductid)
{
// only traverse this branch if we haven't done it
before -- prevent infinte recursion
if (!isset($list["$subproductid"]))
{
$list["$subproductid"] = $subproductid;
$list = array_merge(
$list,
fetch_product_dependencies($subproductid, $dependency_list)
);
}
}
return $list;
}
The way I have figured that out with absolute certainty is by bisection,
by putting a die("some output") statement before calling the function
(exits and outputs "some output") and then moving it after the call to
the function (reproduces the issue).
Expected result:
----------------
Either there is some error in my code or there isn't.
Either way, and no matter what my code does, php must always produce a
valid HTTP response, be it an error or OK response, with or without
content. It can't, under any circumstances, violate the protocol and/or
fail to respond completely, or cause Apache to do so.
Also, the request must always be logged to Apache's access log (if
Apache is configured to do so). Nothing in PHP can ever cause a request
to not be logged at all.
Actual result:
--------------
The output of curl shows that the server fails to return a valid HTTP
response. Apparently it closes the connection abruptly, violating even
the TLS protocol.
I guess PHP is crashing or something.
--
Edit bug report at https://bugs.php.net/bug.php?id=74158&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74158&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74158&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74158&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74158&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74158&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74158&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74158&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74158&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74158&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74158&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74158&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74158&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74158&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74158&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74158&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74158&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74158&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74158&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74158&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74158&r=mysqlcfg