Make WordPress Core

Changeset 43484


Ignore:
Timestamp:
07/17/2018 03:19:26 PM (6 years ago)
Author:
SergeyBiryukov
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.
Merges [43466] to the 4.9 branch.
Fixes #44532.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/functions.php

    r43483 r43484  
    52285228 */
    52295229function wp_is_stream( $path ) {
     5230    if ( false === strpos( $path, '://' ) ) {
     5231        // $path isn't a stream
     5232        return false;
     5233    }
     5234
    52305235    $wrappers    = stream_get_wrappers();
    52315236    $wrappers    = array_map( 'preg_quote', $wrappers );
Note: See TracChangeset for help on using the changeset viewer.