Fixed the bug where the PHP file string length is multiples of 4096

Source: Internet
Author: User
Tags drupal
Today, we saw such a Bug in the Drupal community. When PHP5.3.10 is used on Windows, if the string length of a PHP file is a multiple of 4096, running or calling this PHP file will cause a PHP crash. PHP official bug page in bugs. php. netbug. php? I tested the bug in id60758, so I went to the local wi

Today, we saw such a Bug in the Drupal community. When PHP is 5.3.10 on Windows, if the string length of a PHP file is exactly a multiple of 4096, running or calling this PHP file will cause a PHP crash. PHP official bug page in https://bugs.php.net/bug.php? Id = 60758 testing the bug, so I went to the local wi

Today, we saw such a Bug in the Drupal community.

When a PHP file is in PHP <= 5.3.10 on Windows, if the string length of a PHP file is exactly a multiple of 4096, running or calling this PHP file will directly cause a PHP crash.

PHP official bug page in https://bugs.php.net/bug.php? Id = 60758

Test bug

So I did this test on windows on the local machine. It is amazing that PHP 5.3.9 and PHP 5.3.10 have this bug, but PHP 5.3.8 does not.

The following code is used:

 

To solve the problem, you must Upgrade PHP or prevent the string length of the PHP file from being a multiple of 4096.

I assume that upgrading PHP is the best solution. If not, you have to modify your PHP file.

PHP Solution

When writing a PHP file, determine the PHP version and the file String Length in advance.

 

Condition determination:

  • Version_compare (PHP_VERSION, '5. 3.10 ',' <= '). This Code indicates that the PHP version is smaller than or equal to 5.3.10.
  • ! (Strlen ($ data) % 4096). This Code indicates that the string length is a multiple of 4096.

When conditions are met, use the regular expression in

(...)
Read the rest of fixed the bug (67 words) when the PHP file string length is multiples of 4096)

©Lixiphp for LixiPHP-dedicated to advanced PHP programming !, 2013. | Permalink | No comment | Add to del. icio. us
Post tags: Bug, PHP, PHP 5.3.10, PHP 5.3.9

Feed enhanced by Better Feed from Ozh

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.