1.2.897. Overwriting Variable¶
Replacing the content of a variable by something different is prone to errors. For example, it is not obvious if the $text variable is plain text or HTML text. Besides, it is possible that the source is needed later, for extra processing.
Note that accumulators, like += .= or [] etc., that are meant to collect lots of values with consistent type are OK.
<?php
// Confusing
$text = htmlentities($text);
// Better
$textHTML = htmlentities($text);
?>
1.2.897.1. Connex PHP features¶
1.2.897.1.1. Specs¶
Short name |
Variables/Overwriting |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |