Skip to content

Root_Loader includes directories because it uses file_exists() instead of is_file() #1187

@AceMedia

Description

@AceMedia

Root_Loader.php uses file_exists($filename) before include_once($filename). file_exists() returns true for directories, which can lead to PHP warnings when $filename resolves to a directory or empty value. The minimal fix is to use is_file() and ideally also is_readable() before including.

Patch:
Replace (in /w3-total-cache/Root_Loader.php)
if ( file_exists( $filename ) ) {
with
if ( is_file( $filename ) && is_readable( $filename ) ) {

This prevents directory-includes and avoids PHP warnings. I can provide a small patch file if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions