1.2.115. Cant Use Return Value In Write Context¶
empty() used to work only on data containers, such as variables. Until PHP 5.5, it was not possible to use directly expressions, such as functioncalls, inside an empty() function call : they were met with a ‘Can’t use function return value in write context’ fatal error. This also applies to methodcalls, static or not.
<?php
function foo($boolean) {
return $boolean;
}
// Valid since PHP 5.5
echo empty(foo(true)) : 'true' : 'false';
?>
See also Cant Use Return Value In Write Context.
1.2.115.1. Connex PHP features¶
1.2.115.1.1. Specs¶
Short name |
Php/CantUseReturnValueInWriteContext |
Rulesets |
All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54 |
Exakat since |
0.8.4 |
PHP Version |
With PHP 5.5 and more recent |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |