【搜】php升级到5.3产生问题修正积累(不断更新)

deprecated functions

※ POSIX Regex系列

PHP 5.3.0 之后的 regex, 希望使用 PCRE 的规格, POSIX Regex 都不建议使用了(统一 Regex, 避免规格太多?).
所以下述是不建议使用的 Function (POSIX), 与建议替换成的 Function (PCRE) 列表, 详可见: PHP:
Differences from POSIX regex
* POSIX → PCRE
* ereg_replace() → preg_replace()
* ereg() → preg_match()
* ereg_replace() → preg_replace()
* eregi_replace() → preg_replace()

此函数为不区分大小写,替换时候改为preg_replace("/原规则/i", ...);即可
* eregi() → preg_match()
* split() → preg_split()
* spliti() → preg_split()
* sql_regcase() → No equivalent
* 需要 regex 的 split, 可用 preg_split() 代替
* 不需要 regex, 只要要快速分割固定的字串, 可用 explode() 代替. (速度会比需要 regex 的快很多)

另:

如果一定要用php5.3,请修改php.ini中下面代码

;extension=php_mbstring.dll 修改为;  extension=php_mbstring.dll

;mbstring.func_overload = 0 修改为; mbstring.func_overload = 7

 

deprecated grammar

※ Assigning the return value of new by reference is deprecated in

解决办法:php5.3开始后,废除了php中的”=&”符号,所以要想复制,直接用=引用即可。详细如下:

1、PHP5对象复制是采用引用的方式;
2、如果不采用引用方式,则需要在复制对象时加关键字 clone;
3、如果在复制的过程中,同时要变更某些属性,则增加函数_clone();

或是屏蔽错误

 

 

原文地址:https://www.cnblogs.com/longhua828/p/php-upgrade-5_3-problems.html