What does binary security mean?

Source: Internet
Author: User
Some of the methods in PHP are described as "binary security." What does that mean?

Reply content:

Some of the methods in PHP are described as "binary security." What does that mean?

This means that the function can operate normally when the parameters of the function include binary data.

Strlen, for example, does not stop here when there is a/T in the input data. So it can be said that binary security.

I also see this in the Redis database introduction. I think the binary security should be said:
Only the binary strings are concerned, not the specific format. Only strict binary data access is required. No attempt has been made to parse the data in some form.
Sometimes opening a file in the wrong format can cause irreversible damage to the file. Binary security means that this damage is avoided.

For example, function strcoll, which is non-binary security. The strcmp is binary safe.

The difference between them is:

$string1 = "Hello";$string2 = "Hello\x00Hello";echo strcoll($string1, $string2); // 返回0, 由于是非二进制安全,误判为相等echo strcmp($string1, $string2); // 返回负数
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.