1.2.94. Calltime Pass By Reference¶
PHP doesn’t allow when a value is turned into a reference at functioncall, since PHP 5.4.
Either the function use a reference in its signature, either the reference won’t pass.
<?php
function foo($name) {
$arg = ucfirst(strtolower($name));
echo 'Hello '.$arg;
}
$a = 'name';
foo(&$a);
?>
See also Passing by Reference.
1.2.94.1. Suggestions¶
Make the signature of the called method accept references
Remove the reference from the method call
Use an object instead of a scalar
1.2.94.2. Specs¶
Short name |
Structures/CalltimePassByReference |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
With PHP 5.4 and older |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
by-value, by-reference |
Available in |