[wp-trac] [WordPress Trac] #61590: Make wp_delete_file return to be compliant both with PHP and WPCS

WordPress Trac noreply at wordpress.org
Mon Jul 8 04:14:02 UTC 2024


#61590: Make wp_delete_file return to be compliant both with PHP and WPCS
----------------------------+------------------------------
 Reporter:  bedas           |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  2nd-opinion     |     Focuses:
----------------------------+------------------------------

Comment (by bedas):

 .. and probably also better error handling for when $delete is empty by
 simply removing the check for empty. It should return false in those
 cases.
 {{{#!php
 function wp_delete_file( $file ) {
         /**
          * Filters the path of the file to delete.
          *
          * @since 2.1.0
          *
          * @param string $file Path to the file to delete.
          */
         $delete = apply_filters( 'wp_delete_file', $file );
         return @unlink( $delete );
 }
 }}}

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


More information about the wp-trac mailing list