Conditions | 5 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 8 | public static function escapeParamValue($value) |
|
15 | { |
||
16 | 8 | $count = 0; |
|
17 | 8 | $value = str_replace('\\', '\\\\', $value); |
|
18 | 8 | $value = str_replace('"', '\"', $value, $count); |
|
19 | 8 | $value = str_replace("\n", '\\n', $value); |
|
20 | |||
21 | 8 | if (false !== strpos($value, ';') || false !== strpos($value, ',') || false !== strpos($value, ':') || $count) { |
|
|
|||
22 | 4 | $value = '"' . $value . '"'; |
|
23 | 4 | } |
|
24 | |||
25 | 8 | return $value; |
|
26 | } |
||
27 | } |
||
28 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: