Assuming you mean injection-safe SQL or XSS attacks, perhaps yes. Running only int
ensures that the value is an integer. An integer is usually not dangerous in any context. However, this does not guarantee the safety of an integer value. It may be 0
, which may or may not have much significance in your code, for example, when comparing with false
. Or it may be negative, which again may or may not have any side effects in your code.
"Security" is not an absolute thing. The string "1 = 1; DROP TABLE users"
in itself is pretty safe. It depends on the context in which you use it. Similarly, 0
absolutely safe until your code turns on if (!$number) deleteAllUsers();
.
deceze
source share