Improved autoloader and file inclusion handling - #4572
Open
girishpanchal30 wants to merge 2 commits into
Open
Conversation
Collaborator
There was a problem hiding this comment.
Pull request overview
Hardens Neve’s autoloading and PHP file inclusion against unavailable files.
Changes:
- Adds guarded autoloader and array-file loading.
- Applies guards to assets, patterns, fonts, and templates.
- Adds regression tests and safer font dequeuing.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
autoloader.php |
Validates files and declarations before reporting successful loads. |
globals/utilities.php |
Adds guarded array and asset metadata helpers. |
header-footer-grid/Core/Customizer.php |
Guards the rows template inclusion. |
inc/admin/dashboard/main.php |
Uses guarded dashboard asset metadata. |
inc/admin/metabox/manager.php |
Uses guarded metabox asset metadata. |
inc/compatibility/patterns.php |
Skips unavailable or malformed patterns. |
inc/customizer/loader.php |
Uses guarded Customizer asset metadata. |
inc/views/font_manager.php |
Delays font dequeuing until the local loader is available. |
tests/test-neve-autoloader.php |
Tests autoloader fallback behavior. |
tests/test-neve-file-guards.php |
Tests guarded include helpers and fallbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+154
to
+156
| clearstatcache( true, $file ); | ||
| if ( ! is_file( $file ) || ! is_readable( $file ) ) { | ||
| return false; |
Contributor
Author
There was a problem hiding this comment.
It is fixed with this PR https://github.com/Codeinwp/neve-pro-addon/pull/3234
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
autoloader.php:156
- Returning
falsehere does not prevent the reported frontend fatal in the linked Elementor Booster path. The issue states thatModule::register_widgets()directly instantiates every configured widget; after this autoloader declines the missingFlip_Cardfile, thatnewexpression will still throw an uncaught “Class not found” error. The caller must check that the widget class exists before instantiation (or otherwise handle the failed lookup), and an integration test should exercise that actual registration path rather than only callingload_class()directly.
if ( ! is_file( $file ) || ! is_readable( $file ) ) {
return false;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updated the autoloader logic to skip classes whose files are unavailable instead of fatally failing the request. This change ensures that if a class file cannot be opened (due to reasons like file permissions, missing files, etc.).
Check before Pull Request is ready:
Closes #4566