[wp-trac] [WordPress Trac] #57516: WP_Filesystem_*::dirtiest() may create invalid path
WordPress Trac
noreply at wordpress.org
Fri Jan 20 16:57:12 UTC 2023
#57516: WP_Filesystem_*::dirtiest() may create invalid path
----------------------------+-----------------------------
Reporter: afragen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Filesystem API | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
----------------------------+-----------------------------
`WP_Filesystem_*::dirlist()` creates a nested array of files and
subdirectories. If the directory path sent to the function contains a
trailing slash, the recursion in the function will send something like
`path_to_directroy//subdirectory` this may emit a PHP Warning though this
doesn't seem to effect the results.
This is because line 650 of the function,
{{{
$struc['files'] = $this->dirlist( $path . '/' . $struc['name'],
$include_hidden, $recursive );
}}}
should probably be
{{{
$struc['files'] = $this->dirlist( trailingslashit( $path ) .
$struc['name'], $include_hidden, $recursive );
}}}
to avoid any possible errors.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57516>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list