Digging in our code looking for PHP 4 code I can break?
Fri, Jul 6, 2007 03:10 PM
So, some PHP projects have banded together to put the final death nell into PHP4. They call it GO PHP5. The Phorum team received an invitation to join them. We didn't officially join the list. With Phorum, we have always written our code to do the job that needs to be done. I have never really looked at the docs for a language and thought "oh, where can I use that in my code". That seems to be the direction this is going. From time to time we have had to bump up the minimum versions of PHP and MySQL that are required for Phorum. Those have been done because we had a problem that could not be dealt with in some older version.
Now, what the Phorum team is doing with Phorum 5.2 is writing it with PHP 5.2 and MySQL 5.0. We have done zero testing on PHP 4. We don't really plan on it. We are not however going to purposely break PHP4 which is the feeling I get from the GO PHP5 camp. Is there a good chance that we will use some function that is not available in PHP4? Yeah, probably. Will I care when I use it? No. But, am I going to go find a function and use it just so my application is PHP5 only? No. If we finish it and it works fine in PHP4, I am not going to lie to my users and tell them it won't.
Maybe its OOP that is driving this. Phorum made a decision when we started 5.0 that we would not use OOP in the core. We did it for speed reasons. Speed was most important to us. PHP OOP creates (it seems better now than then) overhead that we don't want or need.
Maybe I took it all wrong. I don't know. I don't mean to offend. But, I also don't want to be on the fictional list of projects that are not "PHP5 ready" because we are not publicly throwing PHP4 into the ether.
Now, what the Phorum team is doing with Phorum 5.2 is writing it with PHP 5.2 and MySQL 5.0. We have done zero testing on PHP 4. We don't really plan on it. We are not however going to purposely break PHP4 which is the feeling I get from the GO PHP5 camp. Is there a good chance that we will use some function that is not available in PHP4? Yeah, probably. Will I care when I use it? No. But, am I going to go find a function and use it just so my application is PHP5 only? No. If we finish it and it works fine in PHP4, I am not going to lie to my users and tell them it won't.
Maybe its OOP that is driving this. Phorum made a decision when we started 5.0 that we would not use OOP in the core. We did it for speed reasons. Speed was most important to us. PHP OOP creates (it seems better now than then) overhead that we don't want or need.
Maybe I took it all wrong. I don't know. I don't mean to offend. But, I also don't want to be on the fictional list of projects that are not "PHP5 ready" because we are not publicly throwing PHP4 into the ether.
Chas. Root Says:
I guess I should open by stating that while I understand the developers desire to drop
continued/extended support for php4, I think it is not unreasonable to continue
supporting it as Apache has done with it's 1.3x version. Which I believe still holds
the lion share of installs. But unfortunately, judging by the comments on the list(s),
the developers seem to look on version 4 as the "red headed step child". As such
can't wait to bury 4 forever. This is really a shame. Given that they owe most of their
success and popularity to v.4.
I've just spent the past 2 mos. evaluating every CMS/blog/forum and related
application available. Anything dated 2004 to date - some 375 in all. All of which
were PHP based. In doing so I have discovered a great deal regarding PHP.
Interesting enough, php4 is much like LEGO(tm). It isn't OO but you simply
"plug-in" any desired functionality. This approach _really_ lends itself to flexibility.
It also makes it easy to keep your application lean, as you only add or "plug-in"
what you actually need. It also makes development a snap. Classes are small
and easy for developers to create, and within reach of almost any development skill
level. No wonder v.4 is so popular. Just look at all the php classes available as proof.
In evaluating all those applications. I also couldn't help but notice that those that
had a minimum v.5 requirement were much larger than those with a v.4 min.
requirement. Drupal included - are you hearing this Larry Garfield? ;)
I evaluated Drupal. It is feature phat. But left a larger foot print than I thought
necessary to deliver those features. I could easily see how I could achieve the
same results in v.4 (php) with currently (and freely) available classes and have a
much smaller foot print. I can only surmise that the development was done in
anticipation of moving to v.5 (again, php). Which simply proves my observation -
php v.5 applications will invariably be larger than their v.4 counterparts. So truly,
where is the gain? Speed? Doubtful. Larger almost always results in being somewhat
slower. Features? Then which ones? UTF is well supported in all of my v.4 base
installs. But I suppose that there _are_ some UTF _enhancements_ in v.5. But still
not enough to _compel_ an immediate upgrade. So what is it really? OO? I think
there could be _many_ arguments on both sides where OO is concerned. My roots
are in assembly. So when all the hype about OO started in the mid 90's, I was in no
hurry to jump on the band wagon. This does _not_ mean I am an opponent. I just
do not feel inclined to use it because it's the "newest" "bleeding-edge" thing that I
_must_ use. Hell, I used Macros in assembler. Which is pretty much pseudo OO.
Point being, OO should be used when it is _truly_ more efficient. I think the biggest
grievance I recall hearing when the php developers announced that v.5 would be
OO based. Was that Sun Microsystems was responsible, as they had made a large
contribution to the development of PHP, and ultimately directed it's course. See
Larry Garfield's comment above "The extended OO support is what got the most
press". _This_ is _why_ it got the most press. Am I saying OO is bad? No. I am not.
It's just that is is _not_ the be-all-to-end-all that it is touted to be. _That_ is my
point. There _are_ times when it is better in fact. But _requiring_ one to use it, was
probably _not_ the best decision to make, where php was/is concerned. So. In my
humble, or not so humble opinion, php v.4 should be allowed to live life for as long
as it is still deemed useful. It should be allowed to continue to live life as Apache's
v.1.3 web server has. It should _not_ be deemed the "red headed step child". But rather,
an alternative to v.5 (or 6).
Note to Larry Garfield:
I am not singling out Drupal as a bad piece of software. My _only_ reason for using
it, was that it was a _convenient_ example. Because you already made reference to
it in this blog. I have absolutely _no_ ill feelings about it - or you. :) My statements
were not, and should not be considered a personal attack on you or your software.
You seem a very kind soul. Thank you in advance for your indulgence. I look
forward to any rebuttal you (or anyone else) would care to make. :)