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.
- define_syslog_variables
- register_globals
- register_long_arrays
- safe_mode
- magic_quotes_gpc
- magic_quotes_runtime
- magic_quotes_sybase
- Comments starting with ‘#’ are now deprecated in .INI files.
Deprecated functions:
- call_user_method()(usecall_user_func()instead)
- call_user_method_array()(usecall_user_func_array()instead)
- define_syslog_variables()
- dl()
- ereg()(usepreg_match()instead)
- ereg_replace()(usepreg_replace()instead)
- eregi()(usepreg_match()with the‘i’modifier instead)
- eregi_replace()(usepreg_replace()with the‘i’modifier instead)
- set_magic_quotes_runtime()and its alias,magic_quotes_runtime()
- session_register()(use the$_SESSIONsuperglobal instead)
- session_unregister()(use the$_SESSIONsuperglobal instead)
- session_is_registered()(use the$_SESSIONsuperglobal instead)
- set_socket_blocking()(usestream_set_blocking()instead)
- split()(usepreg_split()instead)
- spliti()(usepreg_split()with the‘i’modifier instead)
- sql_regcase()
- mysql_db_query()(usemysql_select_db()andmysql_query()instead)
- mysql_escape_string()(usemysql_real_escape_string()instead)
- Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
- Theis_dstparameter tomktime(). Use the new timezone handling functions instead.
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 升级后 不建议使用到函数
请问下Call-time pass-by-reference has been deprecated in 这个问题怎么解决。
修改 php.ini中allow_call_time_pass_reference = On