[wp-trac] [WordPress Trac] #43054: wp_is_stream fails with stream definition containing nonascii chars

WordPress Trac noreply at wordpress.org
Tue Jan 9 11:46:15 UTC 2018


#43054: wp_is_stream fails with stream definition containing nonascii chars
----------------------------+-----------------------------
 Reporter:  tpaksu          |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Filesystem API  |    Version:  4.9.1
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 Hi,

 My `stream_get_wrappers` function returns this array:

 {{{#!php
 array(11) {
   [0]=>
   string(3) "php"
   [1]=>
   string(4) "file"
   [2]=>
   string(4) "glob"
   [3]=>
   string(4) "data"
   [4]=>
   string(0) ""
   [5]=>
   string(163) "0���>�s>����1�DNS_A�>�s>������>�s>��h0�R�DNS_NS�>�"
   [6]=>
   string(3) "zip"
   [7]=>
   string(13) "compress.zlib"
   [8]=>
   string(5) "https"
   [9]=>
   string(4) "ftps"
   [10]=>
   string(4) "phar"
 }
 }}}

 I don't know what's causing the 5th indexed element to be displayed, but
 it breaks my wordpress page with this error:

 {{{
 Warning:  preg_match(): Null byte in regex in /wp-includes/functions.php
 on line 5220
 }}}

 **Note:** Line number may be different because I added some debugging
 codes.

 And I'm using Smart Slider 3 which obviously calls `wp_upload_dir()` which
 calls `wp_mkdir_p()` and it calls `wp_is_stream()` which eventually gives
 this warning.

 I suppose this function may use a check like this:

 {{{#!php
 <?php
 $wrappers = stream_get_wrappers();
 $wrappers = array_filter($wrappers, function($wrapper){
     return preg_match("!^\w+$!", $wrapper);
 });
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43054>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list