迁移到更新版本的PHP [英] Migrating to a newer version of PHP

查看:90
本文介绍了迁移到更新版本的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到几个星期前,PHP 5.3达到了发布候选阶段(呜!),但是随后看到已经被弃用的函数列表最终被删除,这让我开始思考是否会破坏我的任何旧代码.

I notice that a couple of weeks ago PHP 5.3 reached release candidate stage (woo!), but then seeing the list of already-deprecated functions finally being removed, that got me thinking about whether it would break any of my old code.

需要做一次即吸即看"测试(安装在测试服务器上并进行尝试),有没有什么迁移工具可以分析您的代码以突出问题?例如,如果某些脚本使用ereg_*函数.

Short of doing a suck-it-and-see test (installing on a test server and trying it out), are there any sort of migration tools which can analyse your code to highlight issues? For example, if some scripts use the ereg_* functions.

推荐答案

您可以使用的一种技术是获取已删除的不推荐使用的功能的列表,并对其进行grep.一个小的shell脚本fu对于这样的事情大有帮助.

One technique you could use is to take the list of deprecated functions that is being removed and grep for them. A little shell scripting fu goes a long way for things like this.

假设您有一个文件deprecated.txt,其中不赞成使用的函数名每行一个:

Let's suppose you have a file deprecated.txt with deprecated function names one per line:

for func in `cat deprecated.txt`
do
  grep -R $func /path/to/src
done

这将告诉您正在使用的不赞成使用的函数的所有实例.

That will tell you all the instances of the deprecated functions you're using.

这篇关于迁移到更新版本的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆