首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP 4合规性检查器

PHP 4合规性检查器
EN

Stack Overflow用户
提问于 2011-03-10 18:24:12
回答 2查看 181关注 0票数 0

是否有工具可以检查您的代码,并可以反馈任何PHP4遵从性问题?我刚刚为WordPress开发了一个小部件,没有使用任何PHP5.3特性,但使用了PHP5特性。

我没有意识到PHP的版本要求如此之低(PHP4.3),现在我正在考虑“简化”代码以使其通用兼容的任务。

EN

回答 2

Stack Overflow用户

发布于 2011-03-10 18:46:33

您可以使用PEAR包PHP_CompatInfo检查代码。引用:

PHP_CompatInfo将解析文件/文件夹/脚本/数组,以找出运行它所需的最低版本和扩展名。具有高级调试输出,可显示哪些函数需要哪个版本以及CLI输出脚本

Basic Example:

代码语言:javascript
复制
require_once 'PHP/CompatInfo.php';
$source = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'math.php';
$info = new PHP_CompatInfo();
$info->parseFile($source);

另请参阅User Guide for the PHP_CompatInfo

票数 3
EN

Stack Overflow用户

发布于 2011-03-10 18:39:27

使用php 4函数没有问题,首先使用phpinfo()检查服务器的php版本,如果是PHP 5.x,则检查是否正在使用以下任何函数

请参阅下面给出的弃用函数

不推荐使用的函数:

代码语言:javascript
复制
- call_user_method() (use call_user_func() instead)
- call_user_method_array() (use call_user_func_array() instead)
- define_syslog_variables()
- dl()
- ereg() (use preg_match() instead)
- ereg_replace() (use preg_replace() instead)
- eregi() (use preg_match() with the 'i' modifier instead)
- eregi_replace() (use preg_replace() with the 'i' modifier instead)
- set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
- session_register() (use the $_SESSION superglobal instead)
- session_unregister() (use the $_SESSION superglobal instead)
- session_is_registered() (use the $_SESSION superglobal instead)
- set_socket_blocking() (use stream_set_blocking() instead)
- split() (use preg_split() instead)
- spliti() (use preg_split() with the 'i' modifier instead)
- sql_regcase()
- mysql_db_query() (use mysql_select_db() and mysql_query() instead)
- mysql_escape_string() (use mysql_real_escape_string() instead)
- Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
The is_dst parameter to mktime(). Use the new timezone handling functions instead.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5258308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档