[wp-trac] [WordPress Trac] #36308: get_attached_file() destroys file paths on Windows

WordPress Trac noreply at wordpress.org
Wed Aug 24 16:35:44 UTC 2022


#36308: get_attached_file() destroys file paths on Windows
-------------------------------------------------+-------------------------
 Reporter:  Whissi                               |       Owner:  antpb
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.1
Component:  Media                                |     Version:  4.4.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-unit-tests has-testing-info      |     Focuses:
  needs-testing early commit                     |
-------------------------------------------------+-------------------------
Changes (by jrf):

 * keywords:  has-patch has-unit-tests has-testing-info needs-testing early
     commit => has-unit-tests has-testing-info needs-testing early commit
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Uh oh... commit [53934] introduces 10 new test failures on PHP 8.1.

 Failures are along the lines of:
 {{{
 1)
 Tests_oEmbed_Response_Data::test_get_oembed_response_data_with_thumbnail
 ValueError: realpath(): Argument #1 ($path) must not contain any null
 bytes

 path/to/src/wp-includes/functions.php:2104
 path/to/src/wp-includes/functions.php:2139
 path/to/src/wp-includes/post.php:731
 path/to/src/wp-includes/post.php:6833
 path/to/src/wp-includes/post.php:6886
 path/to/src/wp-includes/media.php:192
 path/to/src/wp-includes/media.php:954
 path/to/src/wp-includes/media.php:1032
 path/to/src/wp-includes/post.php:7802
 path/to/tests/phpunit/tests/oembed/getResponseData.php:244
 }}}


 (note: line numbers may be off by a few lines as I'm working in a branch
 with a lot of other patches)

 I'm currently investigating the issue, but suspect that the change to the
 first `if` in the `get_attached_file()` function is the culprit.

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


More information about the wp-trac mailing list