[ciapug] PHP 4 to 5
Dave J. Hala Jr.
dave at 58ghz.net
Wed Nov 23 10:05:28 CST 2005
I really don't need to upgrade, however, I think its time to start
preparing. I'd just hate to end up being in the situation where I have
to upgrade, and then have to do a rewrite on one of my major
applications.
On Wed, 2005-11-23 at 09:59, Tony Bibbs wrote:
> On a side, note, we had a practice in our PHP4 OO code to prefix all
> private methods/members with an underscore:
>
> class foo {
> $var _somePrivateVar = null;
> $var somePublicVar = null;
> function _somePrivateMethod() {
> }
> function somePublicMethod() {
> }
> }
>
> I use to get a bunch of belly-aching from my developers about doing this
> since PHP4 doesn't enforce them but the reason is that upgrading them to
> use the PHP5 features is merely an exercise of search and replace (i.e.
> replace all 'function _' with 'private function ' and all '$var _' with
> 'private '.
>
> So if you are stuck doing some PHP4 coding still...just a word of advice.
>
> --Tony
>
> Dave J. Hala Jr. wrote:
> > Ohhhh.... It maybe that in the past I was on occasion lazy my array
> > keys.... Ohhh....moan.... groan.... Thank god for grep!
> >
> >
> > On Wed, 2005-11-23 at 09:45, Tony Bibbs wrote:
> >
> >>Well, first gotcha will be if you pass any arrays by reference. For
> >>example this isn't allowed:
> >>
> >>$nextValue = array_pop(explode('/',$absolutePathToFile));
> >>
> >>Instead you have to do:
> >>$nextValue = array_pop($tmpArray = explode('/',$absolutePathToFile));
> >>
> >>Or, preferrably
> >>$tmpArray = explode('/',$absolutePathToFile);
> >>$nextValue = array_pop($tmpArray);
> >>
> >>Also, if you got lazy with your array keys you'll pay. This isn't
> >>allowed anymore (which was bad practice to begin with):
> >>
> >>$someArray[someKey]
> >>
> >>Instead it has to be:
> >>
> >>$someArray['someKey']
> >>
> >>If you did OO programming in PHP4, the constructor is now always
> >>__construct() regardless of the class name.
> >>
> >>Obviously the new OO features in PHP5 introduce a number of new keywords
> >>that should probably have been avoided in PHP4 by most folks but I don't
> >>doubt that a few cases may arise.
> >>
> >>--Tony
> >>
> >>
> >>Dave J. Hala Jr. wrote:
> >>
> >>>Hmmm... So it would seems the upgrade issues are relatively minor.
> >>>
> >>>Now, I'm anxious to give it a try!
> >>>On Wed, 2005-11-23 at 08:30, Jeff Davis wrote:
> >>>
> >>>
> >>>>I believe I had that problem upgrading from 3.23 to 4.1
> >>>>and I had to add old_passwords=1 to /etc/my.cnf
> >>>>
> >>>>
> >>>>Jerry Heiselman wrote:
> >>>>
> >>>>
> >>>>>One of the problems you may experience is actually with the move to
> >>>>>mysql 5. They changed the hashing algorithm for the password()
> >>>>>function and that broke a lot custom-made applications that used this
> >>>>>function even though the MySQL documentation advises against this. If
> >>>>>you run into this problem, then you can either modify your code to
> >>>>>call old_password() or modify your my.cnf file with a command that
> >>>>>overrides the default password function (I believe that it's something
> >>>>>like password=old_password.)
> >>>>>
> >>>>>Jerry
> >>>>>
> >>>>>
> >>>>>On 11/23/05, Dave J. Hala Jr. <dave at 58ghz.net> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Were you running alot of "in-house" applications?
> >>>>>>
> >>>>>>On Wed, 2005-11-23 at 07:28, Chris Van Cleve wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>I didn't have any issues moving from 4 to 5. It was smooth and
> >>>>>>>painless. :)
> >>>>>>>
> >>>>>>>Chris VC
> >>>>>>>
> >>>>>>>On Nov 23, 2005, at 7:19 AM, Dave J. Hala Jr. wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Does anyone have any experience taking PHP apps written in PHP4 and
> >>>>>>>>running them on a server with PHP5?
> >>>>>>>>
> >>>>>>>>Did they run?
> >>>>>>>>
> >>>>>>>>I'm considering moving from php-4.3.2-25.ent, and
> >>>>>>>>mysql-3.23.58-15.RHEL3.1 to RHEL 4, with PHP 5 and mysql 5 at the
> >>>>>>>>start
> >>>>>>>>of the next fiscal year.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>:) Dave
> >>>>>>>>
> >>>>>>>>--
> >>>>>>>>
> >>>>>>>>Open Source Information Systems, Inc. (OSIS)
> >>>>>>>>Dave J. Hala Jr., President <dave at osis.us>
> >>>>>>>>641.485.1606
> >>>>>>>>
> >>>>>>>>_______________________________________________
> >>>>>>>>ciapug mailing list
> >>>>>>>>ciapug at cialug.org
> >>>>>>>>http://cialug.org/mailman/listinfo/ciapug
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>>_______________________________________________
> >>>>>>>ciapug mailing list
> >>>>>>>ciapug at cialug.org
> >>>>>>>http://cialug.org/mailman/listinfo/ciapug
> >>>>>>
> >>>>>>--
> >>>>>>
> >>>>>>Open Source Information Systems, Inc. (OSIS)
> >>>>>>Dave J. Hala Jr., President <dave at osis.us>
> >>>>>>641.485.1606
> >>>>>>
> >>>>>>_______________________________________________
> >>>>>>ciapug mailing list
> >>>>>>ciapug at cialug.org
> >>>>>>http://cialug.org/mailman/listinfo/ciapug
> >>>>>>
> >>>>>
> >>>>>_______________________________________________
> >>>>>ciapug mailing list
> >>>>>ciapug at cialug.org
> >>>>>http://cialug.org/mailman/listinfo/ciapug
> >>>>
> >>>>_______________________________________________
> >>>>ciapug mailing list
> >>>>ciapug at cialug.org
> >>>>http://cialug.org/mailman/listinfo/ciapug
> >>
> >>_______________________________________________
> >>ciapug mailing list
> >>ciapug at cialug.org
> >>http://cialug.org/mailman/listinfo/ciapug
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
--
Open Source Information Systems, Inc. (OSIS)
Dave J. Hala Jr., President <dave at osis.us>
641.485.1606
More information about the ciapug
mailing list