[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
Sat Jan 28 08:46:19 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:  Media                          |     Version:  4.7.1
 Severity:  normal                         |  Resolution:
 Keywords:  needs-patch reporter-feedback  |     Focuses:
-------------------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch => needs-patch reporter-feedback


Comment:

 Hi @indextwo, welcome to Trac! Thanks for the report.

 Replying to [comment:1 indextwo]:
 > 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.

 The regex here includes `$wrappers_re` though, not `$path`, and it should
 not contain any null bytes. I could not reproduce the issue on Windows 7
 or 10 with Apache and PHP 7.

 Could you put `var_dump( $wrappers_re );` before that line and see what
 the result is?

 On my install, it's
 `(php|file|glob|data|http|ftp|zip|compress.zlib|https|ftps|phar)`.

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


More information about the wp-trac mailing list