mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Code Modernization: Use str_starts_with() and str_ends_with() in a few more places.
`str_starts_with()` and `str_ends_with()` were introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins or ends with the given substring (needle). WordPress core includes a polyfill for these functions on PHP < 8.0 as of WordPress 5.9. Follow-up to [55990], [56014]. See #58220. git-svn-id: https://develop.svn.wordpress.org/trunk@56019 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1137,7 +1137,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
$filename = trim( $attributes['filename'] );
|
||||
|
||||
// Unquote quoted filename, but after trimming.
|
||||
if ( substr( $filename, 0, 1 ) === '"' && substr( $filename, -1, 1 ) === '"' ) {
|
||||
if ( str_starts_with( $filename, '"' ) && str_ends_with( $filename, '"' ) ) {
|
||||
$filename = substr( $filename, 1, -1 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user