A5下载文章资讯

分类分类

让shopex.4.85支持php5.3的方法详解

2015-05-28 13:52作者:sa

ShopEx 从PHP5.2到PHP5.3移植

移植中出现的问题:

1、短标签问题

shopex中的一些源文件中使用了短标签,<? ...?>.而在PHP5.3中短标签默认是关闭的。所以,我们有两种选择:一是,把所有出现短标签的地方,修改为<?php ...?>;二是,修改PHP配置文件,使其支持短标签。即: [plain] view plaincopyprint? short_open_tag = On

2、变量引用传递问题

PHP5.3中allow_call_time_pass_reference默认是关闭的,如果它是关闭的话,我们在程序中调用函数时,就不能传递一个参数的引用过去。如在mdl_productCat.php中有一段:$result = $this->cat_plan(&$cat_id,&$start,&$count,&$curr,&$total);上面就是传递的引用,这样程序应付报错:Deprecated: Call-time pass-by-reference has been deprecated...因为在shopex的原代码中这种引用传递的地方太多了,可以选择修改配置文件,开启allow_call_time_pass_reference。即: [plain] view plaincopyprint? allow_call_time_pass_reference = On

3、shopex中的使用的函数有些在PHP5.3中已经被废弃(DEPRECATED)

这时,我们就要找到替代函数,把那些废弃的函数替换掉。
在pluginswidgetsmaxrelatedgoodscatwidget_maxrelatedgoodscat.php 文件中就有使用split函数的地方,此函数在PHP5.3中已经被废弃,我们可以使用explode来进行替换,其它例如preg_split函数也可以。最主要的是要找到相应的替代函数,我们可以通过手册,或百度来查找。

部分弃用函数的替代函数:

call_user_method()(使用 call_user_func() 替代)

call_user_method_array() (使用 call_user_func_array() 替代)

define_syslog_variables()

dl()

ereg() (使用 preg_match() 替代)

ereg_replace() (使用 preg_replace() 替代)

eregi() (使用 preg_match() 配合 ‘i’ 修正符替代)

eregi_replace() (使用 preg_replace() 配合 ‘i’ 修正符替代)

set_magic_quotes_runtime() 以及它的别名函数 magic_quotes_runtime()

[color=olive]session_register() (使用 $_SESSION 超全部变量替代)

session_unregister() (使用 $_SESSION 超全部变量替代)

session_is_registered() (使用 $_SESSION 超全部变量替代)

set_socket_blocking() (使用 stream_set_blocking() 替代)

split() (使用 preg_split() 替代)

spliti() (使用 preg_split() 配合 ‘i’ 修正符替代)

sql_regcase()

mysql_db_query() (使用 mysql_select_db() 和 mysql_query() 替代)

mysql_escape_string() (使用 mysql_real_escape_string() 替代)

废弃以字符串传递区域设置名称. 使用 LC_* 系列常量替代.

mktime() 的 is_dst 参数. 使用新的时区处理函数替代.

 

展开全部

相关

说两句网友评论
    我要跟贴
    取消