Skip to content

fix: stop changing runtime error settings and trim unused core includes - #124

Merged
erseco merged 1 commit into
feature/pot-file-referencesfrom
feature/wporg-review-runtime-config
Sep 26, 2026
Merged

erseco merged 1 commit into
feature/pot-file-referencesfrom
feature/wporg-review-runtime-config

Conversation

@erseco

@erseco erseco commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #148, which stops code-only changes from rewriting the translation catalogs. This PR therefore touches no files under languages/.

WordPress.org review findings addressed:

Runtime error settings

The standalone editor page called ini_set( 'display_errors', '0' ) twice and error_reporting( 0 ), which changed the site's PHP configuration for that request. The page already starts an output buffer, and send_and_exit() discards everything printed before the editor document, so the buffer alone keeps the first byte clean. The three calls and their phpcs:ignores are removed.

EditorPageTest now asserts that error_reporting() and display_errors are unchanged after the editor boots. Before, the test restored them.

Core admin includes

  • REST_API::create_elp_file() loaded wp-admin/includes/media.php and image.php but used no function from either. Both are removed.
  • wp-admin/includes/file.php stays in both REST handlers (/create and /save/{id}), because wp_handle_upload() is not loaded in REST requests. Each require_once now sits immediately before its wp_handle_upload() call.
  • The admin-post upload handler (admin/class-admin-upload.php) that the review also cited was removed as dead code in Remove unreachable scaffolding and clean options on uninstall #142.
  • Nothing else in the plugin loads a core admin file. The remaining admin functions (get_current_screen(), submit_button(), add_meta_box()) only run on admin screens where core has already loaded them.

Verification

PHPUnit: OK (911 tests). PHPCS clean. No error_reporting, display_errors or ini_set remains in plugin PHP.

@github-actions

Copy link
Copy Markdown
Contributor

Test in WordPress Playground

Test the plugin with the code from this branch:

Preview in WordPress Playground

ℹ️ The eXeLearning editor is fetched from the shared release and unpacked into the plugin when the playground boots, so the first load may take a few extra seconds. ELP upload, shortcode, Gutenberg block and preview work normally.

@codecov-commenter

codecov-commenter commented Sep 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.40%. Comparing base (bc32141) to head (3a77417).

Additional details and impacted files
@@                        Coverage Diff                        @@
##             feature/pot-file-references     #124      +/-   ##
=================================================================
+ Coverage                          95.71%   96.40%   +0.69%     
- Complexity                             0      827     +827     
=================================================================
  Files                                  7       36      +29     
  Lines                               1049     4228    +3179     
=================================================================
+ Hits                                1004     4076    +3072     
- Misses                                45      152     +107     
Flag Coverage Δ
javascript 95.71% <ø> (ø)
php 96.63% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
includes/class-exelearning-editor.php 93.25% <ø> (ø)
includes/class-exelearning-rest-api.php 99.70% <100.00%> (ø)

... and 27 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@erseco
erseco force-pushed the feature/wporg-review-runtime-config branch from d40db3b to 6d8930e Compare September 26, 2026 10:13
@erseco
erseco changed the base branch from main to feature/pot-file-references September 26, 2026 10:13
@erseco
erseco added this pull request to stack #151 September 26, 2026 10:50
The standalone editor page called ini_set( 'display_errors', '0' ) twice and
error_reporting( 0 ), changing the site's PHP runtime configuration. The
output buffer it already starts is enough: send_and_exit() discards anything
printed before the document, so the three calls are removed and a test now
asserts the settings are left untouched.

REST create loaded wp-admin/includes/media.php and image.php without using
any function from them; they are dropped. wp-admin/includes/file.php stays in
both REST handlers, because wp_handle_upload() is not loaded in REST requests,
and is now required immediately before that call.

The admin-post upload handler the review also cited was removed in #142.
@erseco
erseco force-pushed the feature/wporg-review-runtime-config branch from 6d8930e to 3a77417 Compare September 26, 2026 10:50
@erseco
erseco merged commit 812c9e9 into main Sep 26, 2026
5 checks passed
@erseco
erseco deleted the feature/wporg-review-runtime-config branch September 26, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants