[wp-trac] [WordPress Trac] #58046: Replace include_once with require_once in wp-includes/comment.php

WordPress Trac noreply at wordpress.org
Sat Apr 1 16:54:23 UTC 2023


#58046: Replace include_once with require_once in wp-includes/comment.php
------------------------------+-----------------------------
 Reporter:  wpfy              |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:  trunk
 Severity:  normal            |   Keywords:  needs-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 The WordPress PHP coding standards recommend using require[_once] for
 unconditional includes rather than include[_once]. This is because if the
 file being included is not found, include[_once] will throw a warning but
 continue execution, potentially leading to other errors or security issues
 if the file is needed for the application.

 However, in the WordPress core file wp-includes/comment.php, on lines 3046
 and 3047, the function pingback() includes two files using include_once.
 To ensure consistency with the WordPress coding standards and improve the
 security and stability of the code, I propose replacing include_once with
 require_once on these lines.

 I will create a pull request to the WordPress core repository with this
 change.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58046>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list