迁移到较新版本的 PHP
我注意到几周前 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用的一种技术是获取正在删除的已弃用函数的列表,并对其进行 grep。 一点 shell 脚本 fu 对于这样的事情大有帮助。
假设您有一个文件 deprecated.txt,其中每行一个已弃用的函数名称:
这将告诉您正在使用的已弃用函数的所有实例。
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:
That will tell you all the instances of the deprecated functions you're using.
没有什么比在测试服务器上安装并运行单元测试更好的了。 你确实有单元测试,对吗? ;)
Nothing beats installing on a test server and running your unit tests. You do have unit tests, right? ;)