1.2.1264. Unfinished Object¶
Some of the properties are not assigned a value before or at constructor time. Then, they might be called when one of the other public method is called, and yield a fatal error.
<?php
class x {
private $p;
private $p2;
function __construct($p) {
$this->p = $p;
// $p2 is not assigned
}
function foo() {
$this->p->goo();
// This is not valid
$this->p2->goo();
}
}
?>
See also Compulsory parameters should be required in your constructor.
1.2.1264.1. Connex PHP features¶
1.2.1264.1.1. Suggestions¶
Make sure the object is finished at construction time
1.2.1264.1.2. Specs¶
Short name |
Classes/UnfinishedObject |
Rulesets |
|
Exakat since |
2.3.6 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Precision |
High |
Available in |