1.2.651. Magic Properties

List of magic properties used in the code. A magic property is a property called on a object, whose class doesn’t define that properties, and define the related magic properties __get and __set. Static properties cannot be magic.

Some classes define the magic methods for magic property, but do not use them.

<?php

class x {
     public $normal = 1;

     // Two classic magic properties
     function __get($name) {}

     function __set($name, $value) {}
}

$x = new X;

// Magic propery, so __set is called;
$x->magic = 1;

// Not a magic property.
$x->normal = 2;

?>

1.2.651.1. Specs

Short name

Classes/MagicProperties

Rulesets

All, Inventory

Exakat since

1.9.5

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

magic-property

Available in

Entreprise Edition, Exakat Cloud