Some methods in PHP are described as "binary Security ". What does this mean? Some methods in PHP are described as "binary Security ". What does this mean?
Reply content:
Some methods in PHP are described as "binary Security ". What does this mean?
This means that the function can still operate normally when its parameters include binary data.
For example, if strlen has \ 0 in the input data, it does not stop here. So it can be said that it is binary safe.
I also saw this statement in the redis database introduction. I think the binary security should be:
Only the binary string is concerned, and the specific format is not concerned. Only the binary data is strictly accessed.
Sometimes opening a file in an incorrect format will lead to irreversible damage to the file, while binary security will avoid such damage.
For example, the strcoll function is non-binary secure. Strcmp is binary secure.
Their differences are:
$ String1 = "Hello"; $ string2 = "Hello \ x00Hello"; echo strcoll ($ string1, $ string2); // returns 0 because it is not binary secure, equivalent echo strcmp ($ string1, $ string2); // return a negative number.