1.2.1330. Use Lower Case For Parent, Static And Self

The special parent, static and self keywords needed to be lowercase to be usable. This was fixed in PHP 5.5; otherwise, they would yield a ‘PHP Fatal error: Class ‘PARENT’ not found’.

parent, static and self are traditionally written in lowercase only. Mixed case and Upper case are both valid, though. Until PHP 5.5, non-lowercase version of those keywords are generating a bug.

<?php

class foo {
    const aConstante = 233;

    function method() {
        // Wrong case, error with PHP 5.4.* and older
        echo SELF::aConstante;

        // Always right.
        echo self::aConstante;
    }
}

?>

1.2.1330.1. Suggestions

  • Upgrade to PHP 5.6 or more recent

1.2.1330.2. Specs

Short name

Php/CaseForPSS

Rulesets

All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54

Exakat since

0.8.4

PHP Version

With PHP 5.5 and older

Severity

Minor

Time To Fix

Instant (5 mins)

Precision

High

Features

parent, static, self

Available in

Entreprise Edition, Exakat Cloud