1.2.450. Fallback Function

This rule reports functions that are called with its name alone, and whose definition is in the global scope. Such syntax relies on the fallback mechanism of PHP, which search for functions in the local namespace, then in the global namespace, before failing.

<?php

namespace {
    // global definition
    function foo() {}
}

namespace Bar {
    // local definition
    function foo2() {}

    foo(); // definition is in the global namespace
    foo2(); // definition is in the Bar namespace
}

?>

See also Using namespaces: fallback to global function/constant.

1.2.450.1. Connex PHP features

1.2.450.1.1. Specs

Short name

Functions/FallbackFunction

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

1.1.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud