Using the test code only worked after the PHP bug showed up in the error log while running Wordpress. So, it is possible that the test code only causes the unexpected result on Windows and after a series of other steps that Wordpress does. It is worth noting that this behavior does NOT happen with php 5.6.22. It does happen with both 86 and 64 versions of php 7.0.7.
Running the test code after the error in the PHP log twice actually fixed the whitescreen in Wordpress. So it seems that running the test script can actually fix the issue, but only after it is run twice. Sorry it is so complicated!

[2016-06-25 01:39 UTC] oldbucsfan at hotmail dot com

It continues in php 7.0.8. I don't understand why it is trying to allocate so much memory. This time, running the test script did not fix the white screen.
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4410271868328452703 bytes) in C:\Apache24\htdocs\wordpress\wp-includes\functions.php on line 4946
Actual results:
Array ( [0] => php [1] => file [2] => glob [3] => data [4] => http [5] => ftp [6] => zip [7] =>
Get one of these every few hours in the apache log:
[mpm_winnt:notice] [pid 7824:tid 568] AH00428: Parent: child process 5280 exited with status 3221225477 -- Restarting.
Apache also continuously increases the amount of memory it is using until it is restart with such an error.

The code here is where it occurs:
//Start
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) {
if (stream_protocol) {
add_next_index_str(return_value, zend_string_copy(stream_protocol));
}
} ZEND_HASH_FOREACH_END();
//End
I wonder if what is happening is that php_stream_get_url_stream_wrappers_hash is returning a bad hash (perhaps corrupted or something?). This then goes through a few different stream_protocol iterations. When it hits the bad stream protocol, ZEND_HASH_FOREACH_STR_KEY still thinks it is a string, making the if evaluate as true. Then when zend_string_copy tries to copy the string through the pointer, it accesses a bad memory location and causes the crash.
I don't claim to have any expertise in this, but it was just my thoughts based on a novice look at the code.

@oldbucsfan thanks for staying on this. I'm currently unable to reproduce any crash with the latest ext/ssh2 and php dev trees. It looks more likely there were an issue in the ssh2 ext. I've pushed a couple of fixes to some obvious
issues on x64 there. Could you please check the current ext/ssh2 state?
Thanks.

[2016-07-03 23:07 UTC] oldbucsfan at hotmail dot com

Thanks for that! Sorry if I have sent you on a wild goose chase.
I created a brand new install of Apache 2.4.20 and PHP 7.0.8 just to make sure this was the case. These installs never had the php_ssh2 ext loaded. They gave me the same error within an hour of starting it up. In other words, the issue has nothing to do with php_ssh2. It is in the streams. These are the extensions I have loaded:
extension=php_curl.dll
extension=php_gd2.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_pdo_mysql.dll
I think the issue is that the hash is getting corrupted. Apache seems like it has some major memory leaks. Right now, I am just leaving php_ssh2 unloaded as I am only using it for something under development.

I still have no crash, default wordpress install. It might be, that some WP module could cause it. Are there any non standard modules? Maybe you could try to deactivate them one by one, if any?
Thanks.

[2016-07-05 04:53 UTC] oldbucsfan at hotmail dot com

Thanks! The error happens kind of randomly. It could definitely be a particular plugin. However, I get no errors in any of the logs referring to anything other than getstreamwrappers() which is part of the core. I decided to try taking out all php extensions and add them back. By doing this I found that the offending extension is php_mbstring.dll. When this is not loaded, I don't get the error. I can do without the extension, but still don't know why its presence enables the error. It should be noted that the error only occurs at rather random times when the websites are being used at a good rate. I will just keep this extension disabled. Perhaps it is a plugin conflict with php_mbstring.dll. Unless someone else can think of a reason why php_mbstring would impact getstreamwrappers()?

[2016-07-08 13:47 UTC] oldbucsfan at hotmail dot com

-Status: Feedback+Status: Assigned

[2016-07-08 13:47 UTC] oldbucsfan at hotmail dot com

So, the error didn't really go away. It just morphed into this instead:
Apache crashes and I get the following error in the apache log:
AH00428: Parent: child process 780 exited with status 3221226356 -- Restarting.
Backtrace:
***********************
* EXCEPTION DETAILS *
***********************
DetailID = 1
Count: 2
Exception #: 0XC0000008
Stack:
ntdll!KiRaiseUserExceptionDispatcher+0x3a
KERNELBASE!CloseHandle+0x1b
libapr_1!apr_shm_size_get+0x27d
libapr_1!apr_shm_destroy+0x12
mod_socache_shmcb+0x161c
mod_ssl!ssl_run_proxy_post_handshake+0x8d12
mod_ssl!ssl_run_pre_handshake+0x3d97
libapr_1!apr_pool_clear+0x6e
httpd!OPENSSL_Applink+0xcef
httpd!OPENSSL_Applink+0x1f98
KERNEL32!BaseThreadInitThunk+0x22
ntdll!RtlUserThreadStart+0x34
It will much more rarely, but still result in getstreamwrappers failing as described in this bug report. While the backtrace may imply no real relation to PHP, this error doesn't happen with PHP 5.6. If I enable php_mbstring, this error goes away and the other returns. So, it seems these are being caused by the same problem.

Thanks for the further checks! Now I don't see any PHP issue in the information you've provided. Though from the paths, you use 2.4.20. You could try the latest Apache builds, but otherwise it looks like there's no PHP issue anymore.
Thanks.

[2016-08-14 15:47 UTC] oldbucsfan at hotmail dot com

-Status: Feedback+Status: Assigned

[2016-08-14 15:47 UTC] oldbucsfan at hotmail dot com

Tried latest Apache build with same error. Getting it over and over. Any ideas as to why it would only happen with php7 and not php5?
Thanks again for the help.

[2016-08-19 05:47 UTC] 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 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-12 16:46 UTC] oldbucsfan at hotmail dot com

-Package: ssh2+Package: Apache2 related

[2017-01-12 16:46 UTC] oldbucsfan at hotmail dot com

Should be Apache2 related and not ssh2 related.

[2017-01-12 16:52 UTC] oldbucsfan at hotmail dot com

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).

@oldbucsfan as now there seems to be more or less stable reproduce case, could you please post the backtrace for it? The last backtrace in your comment from 2016-07-08 13:47 UTC did show only issue with Apache SSL module, no PHP. An accompanying thing could be to check, whether OpenSSL in your PHP and Apache are from the same series. Also, as per @boldini, is that still with or without Opcache?
Thanks.

[2017-01-12 19:33 UTC] oldbucsfan at hotmail dot com

-Status: Feedback+Status: Assigned

[2017-01-12 19:33 UTC] oldbucsfan at hotmail dot com

Thanks ab. All Apache/PHP/etc are all using OpenSSL/1.0.2j. So they aren't different versions. I have made sure that the right dlls are being loaded, so it's not a missing or conflicting dll. I'll get another backtrace for you.
Apache 2.4.25 (x64 vc14 ApacheLounge binaries)
PHP 7.1.0 (x64 thread safe from php.net)
boldini, are you also running with https enabled in Apache? It sounds like your error is much less frequent, but I was getting hit over https a few times a second, so a server with less load may not have this error appear but sparingly. It may be something where you need to have all 4 of these to get the error.
1. Apache enabled and fairly often hit over https
2. PHP 7
3. Windows Server 2012? - may or may not be a requirement
4. Some sort of code that triggers the error like the stream_get_wrappers(), although this may be more of a symptom than the source of the problem.

[2017-01-31 15:47 UTC] boldini at softcodex dot ch

hi, I tried to run also ab and abs with -n 1000 -c 10 with the code
$wrappers = stream_get_wrappers();
print_r($wrappers);
$wrappers_re = '(' . join('|', $wrappers) . ')';
print($wrappers_re);
but no crash happens!
I can say my cash happen every 2/3 weeks
Only have 1 site with phpmyadmin that use https, so few connections per day..
All other are normal http

The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Actually can be closed.

[2018-01-07 16:46 UTC] herb at bobbingwide dot com

I've had this problem recently with PHP 7.2.0.
When the problem occurred the message was like this
Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 2178642796290 bytes) in wp-includes\functions.php on line 5216
I added some debug information into the WordPress function wp_is_stream
to discover that $wrappers[5] was corrupted.
function wp_is_stream( $path ) {
$wrappers = stream_get_wrappers();
echo count( $wrappers ) . PHP_EOL;
echo strlen( $wrappers[5] ). PHP_EOL;
print_r( $wrappers );
The print_r()failed due to out of memory since $wrappers[5] was a very long string.
I experienced the problem more than once, over a couple of days, but cannot reproduce it at will.
I had to stop and restart Apache to recover from the error.
When it's working the debug output is:
11
3
Array
(
[0] => php
[1] => file
[2] => glob
[3] => data
[4] => http
[5] => ftp
[6] => zip
[7] => compress.zlib
[8] => https
[9] => ftps
[10] => phar
)

[2018-01-07 16:46 UTC] herb at bobbingwide dot com

I've had this problem recently with PHP 7.2.0.
When the problem occurred the message was like this
Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 2178642796290 bytes) in wp-includes\functions.php on line 5216
I added some debug information into the WordPress function wp_is_stream
to discover that $wrappers[5] was corrupted.
function wp_is_stream( $path ) {
$wrappers = stream_get_wrappers();
echo count( $wrappers ) . PHP_EOL;
echo strlen( $wrappers[5] ). PHP_EOL;
print_r( $wrappers );
The print_r()failed due to out of memory since $wrappers[5] was a very long string.
I experienced the problem more than once, over a couple of days, but cannot reproduce it at will.
I had to stop and restart Apache to recover from the error.
When it's working the debug output is:
11
3
Array
(
[0] => php
[1] => file
[2] => glob
[3] => data
[4] => http
[5] => ftp
[6] => zip
[7] => compress.zlib
[8] => https
[9] => ftps
[10] => phar
)

[2018-07-06 00:10 UTC] federicodib at gmail dot com

PHP 7.2
Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 6426960508499 bytes) in wp-includes\functions.php on line 5231
Is this still a bug?
If not, can anyone help me understand what is this stream_get_wrappers() function used for, and how to debug the cause of this.