迁移到较新版本的 PHP

发布于 2024-07-17 14:51:43 字数 181 浏览 2 评论 0原文

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

除了进行“吮吸看看”测试(安装在测试服务器上并尝试)之外,是否有任何类型的迁移工具可以分析您的代码以突出显示问题? 例如,如果某些脚本使用 ereg_* 函数。

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

思念满溢 2024-07-24 14:51:43

您可以使用的一种技术是获取正在删除的已弃用函数的列表,并对其进行 grep。 一点 shell 脚本 fu 对于这样的事情大有帮助。

假设您有一个文件 deprecated.txt,其中每行一个已弃用的函数名称:

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

这将告诉您正在使用的已弃用函数的所有实例。

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.

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.

烟织青萝梦 2024-07-24 14:51:43

没有什么比在测试服务器上安装并运行单元测试更好的了。 你确实有单元测试,对吗? ;)

Nothing beats installing on a test server and running your unit tests. You do have unit tests, right? ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文