我应该升级到PHP 5.3吗?

时间:2022-09-10 23:05:53

PHP version 5.3 has been released, and although it looks great, all my code already works fine. I don't see what this new version offers to justify upgrading and working through possible issues after the upgrade.

PHP版本5.3已经发布,虽然它看起来很棒,但我的所有代码都已正常工作。我没有看到这个新版本提供什么来证明升级后升级和解决可能的问题。

Should I upgrade anyway just for good practice, or is an upgrade not needed unless I am actually using the new features?

我是否应该仅仅为了良好的练习而升级,或者除非我实际使用新功能,否则不需要升级?

4 个解决方案

#1


You might consider upgrading just for the "Improved PHP runtime speed and memory usage" and bug fixes. Source. I would also say that if you are using create_function anywhere, you should upgrade and replace that ugly, nasty mess, with the much cleaner lambda. Here is the migration guide from 5.2.

您可以考虑升级仅用于“改进的PHP运行时速度和内存使用”以及错误修复。资源。我还会说,如果你在任何地方使用create_function,你应该升级并用更清洁的lambda替换那个丑陋,令人讨厌的混乱。这是5.2的迁移指南。

#2


I'd say there's a few big questions you need to answer to help make this decision. The biggest of which is, what does your site/product/customers do? If you're managing an application (like say a CMS or shopping cart) then you need to understand that many hosts will not be upgrading for a while because they wait for officially supported packages/RPMs for the OS they use, and they take time to build, test and release.

我想说,为了做出这个决定,你需要回答几个重大问题。其中最大的一点是,您的网站/产品/客户做了什么?如果您正在管理应用程序(比如说CMS或购物车),那么您需要了解许多主机将暂时不升级,因为他们等待他们使用的操作系统的官方支持的软件包/ RPM,并且需要时间构建,测试和发布。

If this is just a custom site running on a dedicated server the same question can be some what important. While, in this case, you can always compile by hand that may not necessarily be the best idea if you're as anal about a clean, organized, server as I am. Like Jason mentioned, there are supposed to be significant speed improvements, and as WishCow said, if you use create_function() you can now ditch them for cleaner code.

如果这只是在专用服务器上运行的自定义站点,那么同样的问题可能是一些重要的问题。虽然,在这种情况下,你总是可以手工编译,如果你像我一样干净,有组织的服务器,那么这可能不一定是最好的主意。就像杰森提到的那样,应该会有显着的速度提升,正如WishCow所说,如果你使用create_function(),你现在可以放弃它们以获得更清晰的代码。

Also keep in mind any third party libraries/extensions (PECL, PEAR, Zend Framework, Drupal, Wordpress, or custom written) that you're using that may not work on 5.3 yet for any given reason.

另请注意您使用的任何第三方库/扩展(PECL,PEAR,Zend Framework,Drupal,Wordpress或自定义编写),但由于任何特定原因,可能无法在5.3上使用。

A dry-run upgrade is always better if it's possible. I have a server sitting next to my desk at home that I can use to upgrade and turn on a profiler to see what the performance of my site(s) looks like and make sure everything works. If you can't do this then you have to be careful because there's a chance you'll have some down time if things don't go smoothly.

如果可能的话,干运行升级总是更好。我家里的桌子旁边有一台服务器,我可以用来升级和打开一个分析器,看看我的网站的性能是什么,并确保一切正常。如果你不能这样做那么你必须要小心,因为如果事情进展顺利,你有可能会有一些停工时间。

#3


There are two things that might interest you, the first is replacing create_function()s with lambdas, the other is looking into late static binding. Now that LSB is available, there are a few things that can be resolved in a much much cleaner and more efficient way.

有两件事你可能会感兴趣,第一件事是用lambdas替换create_function(),另一件是调查后期的静态绑定。既然LSB可用,有一些东西可以用更清洁,更有效的方式解决。

Personally, I was anticipating traits, but it didn't get included in this version. I was so sad when I found out :(. Now I don't even remember why I thought it would be included in 5.3.

就个人而言,我期待的是特质,但它没有包含在这个版本中。当我发现时,我很伤心:(。现在我甚至不记得为什么我认为它会包含在5.3中。

#4


I am pondering the same thing... if anything upgrade for the bug fixes, but make sure to check compatibility, a few things have changed in this version (goto, namespaces, parameter parsing, mhash, etc...),

我正在思考同样的事情......如果有什么升级的bug修复,但确保检查兼容性,这个版本中有一些东西已经改变了(goto,命名空间,参数解析,mhash等等),

replacing create_function with lambdas should be enough in itself to upgrade, the memory usage and overhead using create_function is ridiculous.

用lambdas替换create_function本身应该足以升级,使用create_function的内存使用和开销是荒谬的。

check the migration guide http://us.php.net/migration53

查看迁移指南http://us.php.net/migration53

#1


You might consider upgrading just for the "Improved PHP runtime speed and memory usage" and bug fixes. Source. I would also say that if you are using create_function anywhere, you should upgrade and replace that ugly, nasty mess, with the much cleaner lambda. Here is the migration guide from 5.2.

您可以考虑升级仅用于“改进的PHP运行时速度和内存使用”以及错误修复。资源。我还会说,如果你在任何地方使用create_function,你应该升级并用更清洁的lambda替换那个丑陋,令人讨厌的混乱。这是5.2的迁移指南。

#2


I'd say there's a few big questions you need to answer to help make this decision. The biggest of which is, what does your site/product/customers do? If you're managing an application (like say a CMS or shopping cart) then you need to understand that many hosts will not be upgrading for a while because they wait for officially supported packages/RPMs for the OS they use, and they take time to build, test and release.

我想说,为了做出这个决定,你需要回答几个重大问题。其中最大的一点是,您的网站/产品/客户做了什么?如果您正在管理应用程序(比如说CMS或购物车),那么您需要了解许多主机将暂时不升级,因为他们等待他们使用的操作系统的官方支持的软件包/ RPM,并且需要时间构建,测试和发布。

If this is just a custom site running on a dedicated server the same question can be some what important. While, in this case, you can always compile by hand that may not necessarily be the best idea if you're as anal about a clean, organized, server as I am. Like Jason mentioned, there are supposed to be significant speed improvements, and as WishCow said, if you use create_function() you can now ditch them for cleaner code.

如果这只是在专用服务器上运行的自定义站点,那么同样的问题可能是一些重要的问题。虽然,在这种情况下,你总是可以手工编译,如果你像我一样干净,有组织的服务器,那么这可能不一定是最好的主意。就像杰森提到的那样,应该会有显着的速度提升,正如WishCow所说,如果你使用create_function(),你现在可以放弃它们以获得更清晰的代码。

Also keep in mind any third party libraries/extensions (PECL, PEAR, Zend Framework, Drupal, Wordpress, or custom written) that you're using that may not work on 5.3 yet for any given reason.

另请注意您使用的任何第三方库/扩展(PECL,PEAR,Zend Framework,Drupal,Wordpress或自定义编写),但由于任何特定原因,可能无法在5.3上使用。

A dry-run upgrade is always better if it's possible. I have a server sitting next to my desk at home that I can use to upgrade and turn on a profiler to see what the performance of my site(s) looks like and make sure everything works. If you can't do this then you have to be careful because there's a chance you'll have some down time if things don't go smoothly.

如果可能的话,干运行升级总是更好。我家里的桌子旁边有一台服务器,我可以用来升级和打开一个分析器,看看我的网站的性能是什么,并确保一切正常。如果你不能这样做那么你必须要小心,因为如果事情进展顺利,你有可能会有一些停工时间。

#3


There are two things that might interest you, the first is replacing create_function()s with lambdas, the other is looking into late static binding. Now that LSB is available, there are a few things that can be resolved in a much much cleaner and more efficient way.

有两件事你可能会感兴趣,第一件事是用lambdas替换create_function(),另一件是调查后期的静态绑定。既然LSB可用,有一些东西可以用更清洁,更有效的方式解决。

Personally, I was anticipating traits, but it didn't get included in this version. I was so sad when I found out :(. Now I don't even remember why I thought it would be included in 5.3.

就个人而言,我期待的是特质,但它没有包含在这个版本中。当我发现时,我很伤心:(。现在我甚至不记得为什么我认为它会包含在5.3中。

#4


I am pondering the same thing... if anything upgrade for the bug fixes, but make sure to check compatibility, a few things have changed in this version (goto, namespaces, parameter parsing, mhash, etc...),

我正在思考同样的事情......如果有什么升级的bug修复,但确保检查兼容性,这个版本中有一些东西已经改变了(goto,命名空间,参数解析,mhash等等),

replacing create_function with lambdas should be enough in itself to upgrade, the memory usage and overhead using create_function is ridiculous.

用lambdas替换create_function本身应该足以升级,使用create_function的内存使用和开销是荒谬的。

check the migration guide http://us.php.net/migration53

查看迁移指南http://us.php.net/migration53