mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-01 05:57:55 +01:00
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. Built from https://develop.svn.wordpress.org/branches/4.9@43484 git-svn-id: http://core.svn.wordpress.org/branches/4.9@43311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
227534fae8
commit
1fadf698a1
@ -5227,6 +5227,11 @@ function _device_can_upload() {
|
|||||||
* @return bool True if the path is a stream URL.
|
* @return bool True if the path is a stream URL.
|
||||||
*/
|
*/
|
||||||
function wp_is_stream( $path ) {
|
function wp_is_stream( $path ) {
|
||||||
|
if ( false === strpos( $path, '://' ) ) {
|
||||||
|
// $path isn't a stream
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$wrappers = stream_get_wrappers();
|
$wrappers = stream_get_wrappers();
|
||||||
$wrappers = array_map( 'preg_quote', $wrappers );
|
$wrappers = array_map( 'preg_quote', $wrappers );
|
||||||
$wrappers_re = '(' . join( '|', $wrappers ) . ')';
|
$wrappers_re = '(' . join( '|', $wrappers ) . ')';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9.8-alpha-43483';
|
$wp_version = '4.9.8-alpha-43484';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user