Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    478
    Thanks
    3
    Thanked 0 Times in 0 Posts

    need to upgrade PHP4 to PHP5 but what are the pros-cons ?

    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 ?
    Last edited by jasonc310771; 07-13-2008 at 01:03 PM.

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    http://www.php.net/ChangeLog-5.php Look at the changelog.

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    478
    Thanks
    3
    Thanked 0 Times in 0 Posts
    wow lots of changes, these are al the bugs, is there a log of function changes ?

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,129
    Thanks
    2
    Thanked 328 Times in 320 Posts
    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
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    Codeasaurus Rex
    Join Date
    Jun 2008
    Location
    Redmond, WA
    Posts
    659
    Thanks
    31
    Thanked 100 Times in 94 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    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!
    Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
    My posts, comments, code, and suggestions reflect only my personal views.
    Web Portfolio and Code Snippets: http://shanechism.com

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •