ECSHOP perfectly solves the problem of Deprecated: preg_replace () errors

Source: Internet
Author: User
The following small series will bring you an ECSHOP perfect solution for Deprecated: preg_replace () errors. I think it is quite good. now I will share it with you and give you a reference. Let's take a look at it. with the popularity of PHP5.5, the ECSHOP system has encountered new errors. PHP has undergone many minor changes since its development to PHP5.5. The official updates of ECSHOP are too slow. if these problems are detected, they are not upgraded in time, resulting in hundreds of errors during installation and use. After talking about this new error for a long time, the complete error message is as follows:

Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in .......

Note: This error is reported only when ECSHOP in PHP5.5 environment is used.

The following ecshop Development Center (www.68ecshop.com) tutorial first describes the cause of the error:

1) cause of error:

The modifier/e used in the preg_replace () function has been discarded in PHP5.5.x.

If your PHP version happens to be PHP5.5.X, your ECSHOP will certainly report an error similar to the following:

Deprecated: preg_replace (): The/e modifier is deprecated, use preg_replace_callback instead in ......

2) solution:

In fact, we can also see from the error message just now that we use preg_replace_callback to replace preg_replace.

The solution is as follows:

Use Notepad or other PHP editing software (such as editplus) to open the file des/cls_template.php and find

Return preg_replace ("/{([^ \} \ {\ n] *)}/e", "\ $ this-> select ('\ 1 ');", $ source );

Replace

Return preg_replace_callback ("/{([^ \} \ {\ n] *)}/", function ($ r) {return $ this-> select ($ r [1]) ;}, $ source );

Solve the problem.

3 ),If other files in your ECSHOP report a similar preg_replace error, refer to the above method to solve the problem. The solution is the same as the solution.

The above ECSHOP perfectly solves the problem of Deprecated: preg_replace () error, that is, all the content I have shared with you. I hope to give you a reference and support.

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.