Bug #72451 [Com]: Wordpress/ stream_get_wrappers causes crash
| From: | oldbucsfan at hotmail dot com | Date: | Thu, 12 Jan 2017 16:52:54 +0000 |
| Subject: | Bug #72451 [Com]: Wordpress/ stream_get_wrappers causes crash | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206566@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
Comment 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: 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:
Also tests show that this only happens with https connections. Tesing with abs.exe to the same test
code causes the error. Testing with ab.exe to the same test code does not cause the error. Apache
has no problems loading an html page over https. Same test code running PHP 5 does not cause the
error.
So, this seems to be some sort of conflict between Apache https extensions and PHP 7 (doesn't
happen with PHP 5).
Previous Comments:
------------------------------------------------------------------------
[2017-01-12 16:46:47] oldbucsfan at hotmail dot com
Should be Apache2 related and not ssh2 related.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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