_php instance of Ecshop resolution for PHP5.5 and high version escalation errors

Source: Internet
Author: User
Tags deprecated explode modifier

Ecshop did not have time to modify, if the high version of the PHP virtual host installed Ecshop program, there is a compatibility problem.

Small series on the local environment php5.5 installed on the following two kinds of error prompts :

Only variables should is passed by reference PHP
Deprecated:preg_replace (): the/e modifier is deprecated, use preg_replace_callback instead ...?

Through the search on the network, small set found not only in the lower version of PHP installed, but also found a solution to facilitate everyone in the php5.5 version of the debug program. Small knitting is here to share the solution to everyone:

First, explain the solution to the first problem:

PHP more than 5.3 version of the problem, and configuration about as long as 418 lines to break this sentence into two is no problem.

The following:

$tag _sel = array_shift (Explode (', $tag));

Modified to:

$tag _arr = Explode (", $tag); $tag _sel = Array_shift ($tag _arr);

Because the Array_shift parameter is passed by reference, more than 5.3 of the default can only pass the specific variable, but not the function return value

The second way to answer the error:

File found:include/cls_template.php

The following code:

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

Modified into:

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

Small series currently only encountered such two error, if the program debugging and development process encountered other problems, if it can be resolved, small series will be sorted out the solution.

Ecshop solution for error in high version PHP

1. Ecshop hint Strict standards:non-static method cls_image

:: Gd_version () should not is called statically ine:/wwwroot/weirenchou/includes/lib_base.php on line 346

Find 346, okay?

Return Cls_image::gd_version ()

Replace with:

$p = new Cls_image (); return $p->gd_version ();

2. The following error occurred when Ecshop:

Deprecated:preg_replace (): the/e modifier is deprecated and use preg_replace_callback instead Late.php on line 300

Open Ecshop directory and find includes/cls_template.php to line No. 300

Put

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

Replace into

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

3. Strict Standards:only variables should is passed by reference into e:/web/shopex/includes/cls_template.php on line 422

$tag _sel = array_shift (Explode (', $tag));

Change into:

$tag _arr = Explode (", $tag); $tag _sel = Array_shift ($tag _arr);

4. Membership Integration appears

Phpbb::set_cookie () should is compatible with integrate

/includes/modules/integrates/phpbb.php on line 232

110 Line

function Set_cookie ($username = "")

Modified into

function Set_cookie ($username = "", $remember = NULL)

includes/modules/integrates/phpwind6.php

ucenter.php vbb.php also modified this way

ucenter.php 210 Lines modified into

 function Add_user ($username, $password, $email, $gender =-1, $bday = 0, $reg _date = 0, $md 5password = ')

127 lines modified into

function login ($username, $password, $remember = NULL)

5. Database backup appears

Edefining already defined constructor for class Cls_sql_dump in line 

 function __construct (& $db, $max _size =)

  {

    $this->cls_sql_dump ($db, $max _size);

  

Move to front of function cls_sql_dump (& $db, $max _size=0)

Non-static method Cls_sql_dump::get_random_name () admin/database.php in line 64

Open includes/cls_sql_dump.php

479 lines

function Get_random_name ()

Modified into

static function Get_random_name ()

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.