1.2.1242. Undefined Classes

Those classes are used in the code, but there are no definition for them.

This may happens under normal conditions, if the application makes use of an unsupported extension, that defines extra classes; or if some external libraries, such as PEAR, are not provided during the analysis.

This analysis also checks in attributes.

<?php

// FPDF is a classic PDF class, that is usually omitted by Exakat.
$o = new FPDF();

// Exakat reports undefined classes in instanceof
// PHP ignores them
if ($o instanceof SomeClass) {
    // doSomething();
}

// Classes may be used in typehint too
function foo(TypeHintClass $x) {
    // doSomething();
}

?>

1.2.1242.1. Suggestions

  • Fix the typo in the class name

  • Add a missing ‘use’ expression

  • Create the missing class

  • Added a missing component

1.2.1242.2. Specs

Short name

Classes/UndefinedClasses

Rulesets

All, Analyze

Exakat since

0.8.4

PHP Version

All

Severity

Major

Time To Fix

Slow (1 hour)

Precision

Medium

Features

class

Available in

Entreprise Edition, Exakat Cloud