Make WordPress Core


Ignore:
Timestamp:
07/17/2018 07:53:18 AM (6 years ago)
Author:
pento
Message:

Streams: Return early from wp_is_stream() for paths that aren't streams.

Some versions of PHP appear to have a memory leak that is occasionally triggered by calling stream_get_wrappers(). In order to avoid calling this, we can return early from wp_is_stream() when $path doesn't contain ://.

Props pbiron, JPry, dontstealmyfish.
Fixes #44532.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r43434 r43466  
    55545554 */
    55555555function wp_is_stream( $path ) {
     5556    if ( false === strpos( $path, '://' ) ) {
     5557        // $path isn't a stream
     5558        return false;
     5559    }
     5560
    55565561    $wrappers    = stream_get_wrappers();
    55575562    $wrappers    = array_map( 'preg_quote', $wrappers );
Note: See TracChangeset for help on using the changeset viewer.