[wp-trac] [WordPress Trac] #51340: Stop chmodding files and folders

WordPress Trac noreply at wordpress.org
Mon Mar 27 11:14:51 UTC 2023


#51340: Stop chmodding files and folders
----------------------------+------------------------------
 Reporter:  malthert        |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Filesystem API  |     Version:  5.3
 Severity:  major           |  Resolution:
 Keywords:  dev-feedback    |     Focuses:
----------------------------+------------------------------

Comment (by costdev):

 Thanks for the feedback so far @kkmuffme and @azaozz!

 > Atm when you have `chmod` (and `chown`) in your php.ini
 `disable_functions` directive, you run into errors all the time.

 In that case, we could just guard calls to these functions with
 `function_exists()` checks. That way, if a server admin wants to disable
 these functions because of their preferred configuration, Core won't
 output any errors. It removes the need to add a filter or constant for
 each site on the server, and means  Core doesn't have to maintain a
 constant/filter for this purpose.

 What do you both think?

 -----

 For reference, uses of `chmod()` outside of the Filesystem API's
 `::chmod()` methods are:
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-admin/setup-
 config.php#L485 setup-config.php]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 admin/includes/file.php#L1020 _wp_handle_upload()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 admin/includes/misc.php#L127 insert_with_markers()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 admin/includes/upgrade.php#L3221 make_site_theme_from_oldschool()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 admin/includes/upgrade.php#L3287 make_site_theme_from_default() 1]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 admin/includes/upgrade.php#L3330 make_site_theme_from_default() 2]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-includes
 /class-wp-image-editor-gd.php#L507 WP_Image_Editor_GD::_save()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-includes
 /class-wp-image-editor-imagick.php#L797 WP_Image_Editor_Imagick::_save()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 includes/functions.php#L2078 wp_mkdir_p()]
 - [https://github.com/wordpress/wordpress-
 develop/blob/4bdfbf40462771f1b97bda931ab14baaa61d1a5c/src/wp-
 includes/functions.php#L2946 wp_upload_bits()]

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


More information about the wp-trac mailing list