[wp-trac] [WordPress Trac] #39722: wp_upload_dir() causing preg_match(): null byte in regex in wp-includes\functions.php on line 5163

WordPress Trac noreply at wordpress.org
Fri Jan 27 17:01:53 UTC 2017


#39722: wp_upload_dir() causing preg_match(): null byte in regex in wp-
includes\functions.php on line 5163
--------------------------+------------------------------
 Reporter:  indextwo      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.7.1
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------
Changes (by indextwo):

 * keywords:   => needs-patch


Comment:

 '''Update'''

 Haven't had time to really look into why this is happening on a Windows
 platform specifically, but I have found a fix:

 As per this thread: http://stackoverflow.com/a/39603464/988246 I changed
 the return of `wp_is_stream($path)` to single quotes rather than double:

 `return preg_match( '!^$wrappers_re://!', $path ) === 1;`

 The linked SO post suggests to me that the `$path` parameter of
 `wp_is_stream` is being passed null byte(s), and `preg_replace` with
 double quotes (`"`) is trying to parse them.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39722#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list