Make WordPress Core


Ignore:
Timestamp:
04/09/2023 11:55:37 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Replace include_once with require_once for required files.

Per 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 [1674], [1812], [1964], [6779], [8540], [10521], [11005], [11911], [16065], [16149], [25421], [25466], [25823], [37714], [42981], [45448], [47198], [54276], [55633].

Props kausaralm, SergeyBiryukov.
See #57839.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r55526 r55641  
    30523052 */
    30533053function pingback( $content, $post ) {
    3054     include_once ABSPATH . WPINC . '/class-IXR.php';
    3055     include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
     3054    require_once ABSPATH . WPINC . '/class-IXR.php';
     3055    require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    30563056
    30573057    // Original code by Mort (http://mort.mine.nu:8080).
     
    32193219 */
    32203220function weblog_ping( $server = '', $path = '' ) {
    3221     include_once ABSPATH . WPINC . '/class-IXR.php';
    3222     include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
     3221    require_once ABSPATH . WPINC . '/class-IXR.php';
     3222    require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    32233223
    32243224    // Using a timeout of 3 seconds should be enough to cover slow servers.
Note: See TracChangeset for help on using the changeset viewer.