Today when I tried to edit my site on local I got strange error like this :
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 6874029536211531203 bytes) in D:\wamp64ario\www\owjgraph\wp-includes\functions.php on line 5231
Why it tried to allocate for 6874029536211531203?
Sometimes I get this when I try to reach Login Page, other times in different situations like dashboard or update posts etc.
I tried many things but no success:
memory_limit
to 256, 512 or 1GB in WAMP but no success.None of them solved my problem and I'm really confused.
Is this something wrong with my Windows or registry? How can I debug or trace where this problem is coming from?
Try: Look in your error logs, you may get a trace that will zero in on the problem for you (like an infinite loop).
Locate the line that is throwing the error & determine if it can be refactored to avoid the memory usage.
You can override php's memory allocation in your wp-config, like so: define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
but this is just a bandaid in my opinion. There is likely something wrong, which you'll need to fix for the long term health of your application.
The same thing is happening to me. If I var_dump stream_get_wrappers() I get weird results with very long lines of gibberish text. I think it's WAMP's fault, because I also get this error in plain php. Temporary solution for WordPress:
Open wordpress/wp-includes/functions.php and modify wp_is_stream function to look like this:
function wp_is_stream( $path ) {
$wrappers = stream_get_wrappers();
for ($i=0;$i<count($wrappers);$i++) {
if (strlen($wrappers[$i])>100) {
unset($wrappers[$i]);
}
}
$wrappers_re = '(' . join('|', $wrappers) . ')';
return preg_match( "!^$wrappers_re://!", $path ) === 1;
}
I use WampServer 3.0.6 64bit