...

View Full Version : need to upgrade PHP4 to PHP5 but what are the pros-cons ?



jasonc310771
07-13-2008, 12:52 PM
I hope to upgrade but would like to know the pros-cons of doing so..
like will all my scripts still work?

are all the PHP4 commands still available in PHP5 ?

where do i find a list of changes ?

rafiki
07-13-2008, 01:50 PM
http://www.php.net/ChangeLog-5.php Look at the changelog.

jasonc310771
07-13-2008, 04:33 PM
wow lots of changes, these are al the bugs, is there a log of function changes ?

CFMaBiSmAd
07-13-2008, 05:10 PM
PHP4 code that does not use any old depreciated functions or features (register_globals, register_long_arrays...) will work under php5. There are very few incompatible changes (even php4 OOP syntax works under php5) - http://www.php.net/manual/en/migration5.php

ShaneC
07-13-2008, 11:54 PM
PHP4 code that does not use any old depreciated functions or features (register_globals, register_long_arrays...) will work under php5. There are very few incompatible changes (even php4 OOP syntax works under php5) - http://www.php.net/manual/en/migration5.php

To add onto what CFMaBiSmAd said, the main reason the PHP developers took this out was because frankly you shouldn't be using them in the first place. This is a very easy way of passing information between scripts, but at the same time gives a potential hacker an extraordinarily easy way to pass code as well.

Whether you intend to upgrade or not I still highly recommend you can any register_globals you may have in your script already. You'll be thankful you did!

Fou-Lu
07-14-2008, 12:27 AM
Hold on guys, you are jumping ahead. Both register_globals and register_long_arrays directives are still available in PHP 5, although deprecated they will still work. PHP 6 is officially removing these functions along with magic_quotes - all of which make me very happy.
Register globals are sadly still in use today, and I know of several developers that choose an .htaccess route to re-enable their globals instead of fixing the flaws within it. I warned them years ago that they day would come that none of their script would work.

array_merge is one of the few that I have seen cause problems between php 5 and php 4. Even though the api listed array_merge could only accept array parameters, it was well known that array_merge could be forced to accept an array and a string. This was one block of code that was highly exploited since people were too lazy to construct their own arrays.

Other than that, I'd say the big changes (usability wise) are within the PHP 5 versions - specifically the object cores. PHP 5.0.x has terrible object handling with extremely poor polymorphism and dynamic binding with poorly scoped methods. Further versions improved these, but caused the 'hacks' required to make the old work to fail. The object core is far from perfect but is getting better with each release.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum