Skip to content

Improved autoloader and file inclusion handling - #4572

Open
girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/4566
Open

Improved autoloader and file inclusion handling#4572
girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/4566

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

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

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Aug 7, 2026
@pirate-bot

pirate-bot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Plugin build for d83bdf3 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread autoloader.php
Comment on lines +154 to +156
clearstatcache( true, $file );
if ( ! is_file( $file ) || ! is_readable( $file ) ) {
return false;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread header-footer-grid/Core/Customizer.php Outdated
Comment thread tests/test-neve-autoloader.php Outdated
Comment thread globals/utilities.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 false here does not prevent the reported frontend fatal in the linked Elementor Booster path. The issue states that Module::register_widgets() directly instantiates every configured widget; after this autoloader declines the missing Flip_Card file, that new expression 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 calling load_class() directly.
		if ( ! is_file( $file ) || ! is_readable( $file ) ) {
			return false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants