PHP 升级后 不建议使用到函数

PHP 林涛 8461℃ 0评论

PHP又升级了,是因为莫名其妙到报告 session_register 不能使用,经过一番查找,才知道是因为昨天对Ubuntu作了升级,顺便PHP也升级了。经过整理,把PHP5.3以上版本到不能使用或者不建议使用到函数整理出来。

Windows 下用PHP 5.3.2 部署 Testlink 1.8.5, Apache2.2的error.log中会发生
PHP Deprecated:  Function ereg_replace() is deprecated in (Dir):\\testlink\\lib\\functions\\lang_api.php on line 173, referer: …
的 错误。
这是由于Testlink 1.8.5 的php源码中有些方法在 php 5.3版本中已不推荐使用。

===============================
这 个是我个人解决安装出现问题的方法:
修改testlink1.8.5的php源码,修复此问题。
需要修改的文件以及方法:
1. testlink\lib\functions\lang_api.php, line173
将 $t_lang_var = ereg_replace( ‘^TLS_’, ”, $t_var );
修改为 $t_lang_var = preg_replace( ‘^TLS_^’, ”, $t_var );
(这里添加^是因为方法中关于delimiter的用法。否则会发生 Warning: preg_replace() [function.preg-replace]: No ending delimiter ‘:’ found in …)
2. testlink\third_party\phplayersmenu\dumps\sqlite.demo_data.dump.php5 中 ereg_replace方法改为preg_replace;
testlink\third_party\phplayersmenu\dumps\sqlite.start.dump.php5 中 ereg_replace方法改为preg_replace;
3. testlink\third_party\phplayersmenu\lib\layersmenu-common.inc.php 中 ereg_replace方法改为preg_replace.
===============================

参 考官方文档说明: http://php.net/manual/en/migration53.deprecated.php

Deprecated features in PHP 5.3.x

PHP 5.3.0 introduces two new error levels:E_DEPRECATEDandE_USER_DEPRECATED. TheE_DEPRECATEDerror level is used to indicate that a function or feature has been deprecated. TheE_USER_DEPRECATEDlevel is intended for indicating deprecated features in user code, similarly to theE_USER_ERRORandE_USER_WARNINGlevels.

The following is a list of deprecated INI directives. Use of any of these INI directives will cause anE_DEPRECATEDerror to be thrown at startup.

Deprecated functions:

Deprecated features:

  • Assigning the return value ofnewby reference is now deprecated.
  • Call-time pass-by-reference is now deprecated.
  • The use of{}to access string offsets is deprecated. Use[]instead.

如需转载请注明: 转载自26点的博客

本文链接地址: PHP 升级后 不建议使用到函数

转载请注明:26点的博客 » PHP 升级后 不建议使用到函数

喜欢 (0)
发表我的评论
取消评论

表情
(2)个小伙伴在吐槽
  1. 请问下Call-time pass-by-reference has been deprecated in 这个问题怎么解决。
    • 修改 php.ini中allow_call_time_pass_reference = On
      笃笃2011-05-09 17:55 回复