[wp-trac] [WordPress Trac] #57839: Coding Standards fixes for WP 6.3

WordPress Trac noreply at wordpress.org
Sat Apr 8 09:09:09 UTC 2023


#57839: Coding Standards fixes for WP 6.3
----------------------------+---------------------
 Reporter:  hellofromTonya  |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  6.3
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+---------------------

Comment (by SergeyBiryukov):

 In [changeset:"55633" 55633]:
 {{{
 #!CommitTicketReference repository="" revision="55633"
 Twenty Twenty-One: Replace `include_once` with `require_once` for required
 classes.

 Per [https://developer.wordpress.org/coding-standards/wordpress-coding-
 standards/php/#writing-include-require-statements WordPress PHP coding
 standards], it is ''strongly recommended'' to use `require[_once]` for
 unconditional includes. When using `include[_once]`, PHP will throw a
 warning when the file is not found but will continue execution, which will
 almost certainly lead to other errors/warnings/notices being thrown if
 your application depends on the file loaded, potentially leading to
 security leaks. For that reason, `require[_once]` is generally the better
 choice as it will throw a `Fatal Error` if the file cannot be found.

 Follow-up to [49216], [49633].

 Props wpfy.
 See #57839.
 }}}

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


More information about the wp-trac mailing list