Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace include_once with require_once in wp-includes/comment.php #4280

Closed
wants to merge 1 commit into from

Conversation

akramulhasan
Copy link

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.

Trac ticket: https://core.trac.wordpress.org/ticket/58046


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

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.
@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in r55641 as part of a few other similar changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants