phanalist

E0055: Dynamic Include or Require

In plain English: include $path loads whatever file the variable points to. If the path comes from a request, an attacker may be able to load an unexpected file.

Why it matters: Dynamic include paths can load attacker-controlled code, expose local files, and make it difficult to know which files a project uses.

Bad

include $_GET['page'];
include $base . '/bootstrap.php';

Good

switch ($page) {
    case 'home':
        include __DIR__ . '/pages/home.php';
        break;

    case 'about':
        include __DIR__ . '/pages/about.php';
        break;

    default:
        http_response_code(404);
}

Literal paths, __DIR__, __FILE__, and project constants such as APP_ROOT are treated as safe.

What the rule checks

When it does not report

How to fix

Model limits

Configuration

E0055 has no configuration options and is enabled by default.