Bug #72451 [Asn]: Wordpress/ stream_get_wrappers causes crash
| From: | oldbucsfan at hotmail dot com | Date: | Thu, 12 Jan 2017 16:46:50 +0000 |
| Subject: | Bug #72451 [Asn]: Wordpress/ stream_get_wrappers causes crash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206565@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72451&edit=1
ID: 72451
User updated by: oldbucsfan at hotmail dot com
Reported by: oldbucsfan at hotmail dot com
Summary: Wordpress/ stream_get_wrappers causes crash
Status: Assigned
Type: Bug
-Package: ssh2
+Package: Apache2 related
Operating System: Windows Server 2012 R2
PHP Version: 7.0.7
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
Should be Apache2 related and not ssh2 related.
Previous Comments:
------------------------------------------------------------------------
[2017-01-11 18:49:30] oldbucsfan at hotmail dot com
The fix only help stop errors in the Wordpress debug log. Apache is still crashing with the same
error code at the same frequency.
------------------------------------------------------------------------
[2017-01-11 15:27:08] oldbucsfan at hotmail dot com
Okay, so using abs.exe 1000s of times with the following code will cause the crash:
-------------------------------
Test script:
$wrappers = stream_get_wrappers();
print_r($wrappers);
$wrappers_re = '(' . join('|', $wrappers) . ')';
print($wrappers_re);
This seems to temporarily relieve the issue.
----------------------------
Fix:
$wrappers = stream_get_wrappers();
print_r($wrappers);
$wrappers_re =
"(php|file|glob|data|http|ftp|zip|compress.zlib|https|ftps|phar|ssh2.shell|ssh2.exec|ssh2.tunnel|ssh2.scp|ssh2.sftp)";
print($wrappers_re);
------------------------------------------------------------------------
[2017-01-11 15:10:06] oldbucsfan at hotmail dot com
Thanks! Glad to know I'm not crazy!
------------------------------------------------------------------------
[2016-12-17 15:33:19] boldini at softcodex dot ch
Hi, I'm having the same exact problem. Every 1 to 30 days (randomly) apache return a 500 error,
only of wordpress site that use this portion of code
$wrappers = stream_get_wrappers();
$wrappers_re = '(' . join('|', $wrappers) . ')';
contained in wp-includes/functions.php wp_is_stream() function line 4944
Other php site (not wp) run normally fine. When restarting apache wp sites return working ok.
I tried to debug before restarting apache in index.php of wp, and putting this code before wp calls
and exit (so no wp code are executing).
$wrappers = stream_get_wrappers();
$wrappers_re = '(' . join('|', $wrappers) . ')';
1. print_r($wrappers);
2. print_r(count($wrappers));
3. print_r(strlen($wrappers[10]));
exit();
Output was (point 1 is truncated):
1. Array ( [0] => php [1] => file [2] => glob [3] => data [4] => http [5] => ftp
[6] => zip [7] => compress.zlib [8] => compress.bzip2 [9] => https [10] =>
2. 12
3. sorry no exact output, but was someting like 12TB -> 12123123123123
the right output after apache restart is:
1. Array ( [0] => php [1] => file [2] => glob [3] => data [4] => http [5] => ftp
[6] => zip [7] => compress.zlib [8] => compress.bzip2 [9] => https [10] => ftps [11]
=> phar )
2. 12
3. 4
I'm running Windows 2012 R2, apache VC14 2.4.20 win64 and php 7.0.12 ts x64 with opcache
enabled for all sites
no php_ssh2 loaded.
I'm not 100% sure but as I remember the problem begin to occur after enabling opcache, I hope
this help.
------------------------------------------------------------------------
[2016-08-19 05:47:57] oldbucsfan at hotmail dot com
I tried again with php7 and continued to get the error when hitting https. Used abs.exe to test it
and almost always get the error within 3 tests of 1000 requests. Usually get it in the first few
hundred when hitting a wordpress site over SSL. Get it when all plugins are disabled. Get it hitting
a website not using wordpress at all. Tried it with all extensions disabled except mysqli (needed to
load the website). In other words, I can't seem to use Apache 2.4 with SSL and PHP 7. Tried
basically totally simplifying the config files to the simplest form. Tried totally replacing the
installs. The only thing that solves the error is using PHP 5.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72451
--
Edit this bug report at https://bugs.php.net/bug.php?id=72451&edit=1