Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Dropping support for PHP 5.0 and 5.1 ...


Reply

3 Posts   1397 Views

Avatar
Sigurd

11 July 2007 at 11:09am (Last edited: 11 July 2007 11:30am), Forum Moderator, 628 Posts

It seems to be that

a) Webhosts should keep their PHP versions to the latest stable version, mainly for security, but secondly for bug fixes and to take advantage of new features. PHP 5.2 came out in November last year and thus is PHP 5.2.0 - 5.2.3 would be my current description for up to date.

b) The only reason for keeping back is that scripts known to work on 5.0/5.1 may not work with 5.2, and there's time involved in testing this (we know this full well, we have a server in this state).

c) Therefore we should encourage (but not require) those installing SilverStripe to use PHP 5.2, so that SilverStripe runs as securely and bug-free as possible, and as a bonus, allows us to make use of the (minor as I see it) new features.

I see this done as a notice in the installer saying phrases like "we encourage using 5.2 for SilverStripe... your version of PHP is old, buggy and insecure ... your current version will work now, however later versions of SilverStripe may not work unless you upgrade to 5.2"

d) With the view that by [url=http://www.gophp5.org/]February 5, 2008[/url], SilverStripe will altogether officially drop support for PHP 5.0/5.1, which specifically means not testing it on those versions, and using code that is known to break on those versions.

e) Its important to realise that SilverStripe's minimum version is slowly increasing anyway, as we find major use of functions or code that breaks due to PHP bugs. For instance, PHP 5.0.3 had a number of bugs where we decided not to deal with, and instead say "upgrade" to. So, I feel we're essentially doing (e) without realising it, but it is healthier for us to definitively act on this, and encourage use of installing SilverStripe of PHP 5.2 webhosts so that we can make use of it.

f) As a side note, one major reason large packages (anything from SilverStripe1 or Drupal) get themselves into trouble is through holding onto an old version. By incrementally lifting the minimum PHP version, it will be easier to eventually make use of PHP 5.3 or 6.0 features, so this is all part of a long term strategy of keeping SilverStripe in the lead.

See PHP 5 Changelog: [url]http://www.php.net/ChangeLog-5.php[/url]

Avatar
Sigurd

11 July 2007 at 11:45am (Last edited: 11 July 2007 11:50am), Forum Moderator, 628 Posts

Oh, so my take on the actual improvements in 5.0 to 5.1??

Many people are touting [url=http://www.gophp5.org/faq#n7]a few killer features[/url] that are reason to upgrade. I disagree.

Instead, I see [url=http://www.php.net/ChangeLog-5.php]a thousand small improvements[/url] that collectively work together in lieu, and add up to the same benefit of, a 'killer feature'. This is why I believe PHP 5.2 upgrades should occur.

The supposed 'killer features' could have well be left out, and my notion of upgrading to get all the other fixes and improvements would still be as true.

- JSON can be [url=http://pear.php.net/pepr/pepr-proposal-show.php?id=198]done in PHP 5.0/1[/url]. So... PHP 5.2 only makes it faster (and currently buggier from our experience).
- [url=http://www.php.net/pdo]PDO[/url], which we hope to use shortly to allow multiple database support, also works in PHP 5.0
- The [url=http://devzone.zend.com/node/view/id/1113]filter extension[/url] seems to provide no new functionality; you now have a consistent way of writing long-winded input data checking instead of an inconsistent way of doing it. They should have built it with OO and made the error messages a part of the system, then I'd be blogging about how wonderful it is. See jsuchal's great code ideas at
[url]http://devzone.zend.com/node/view/id/1113[/url]

I'd like for others to comment, especially in highlighting what new code DOES actually bear significance.

Avatar
Sigurd

12 July 2007 at 12:14am (Last edited: 12 July 2007 12:16am), Forum Moderator, 628 Posts

I [url=http://groups.google.com/group/nzphpug/browse_thread/thread/942e510a4fc5f39f/#]posted this to the New Zealand PHP mailing list[/url], and so far the only interesting information is PHP 5.2's __toString method

which as explained at [url]http://www.onekay.com/blog/archives/14[/url], states up till 5.2 __toString() was only called when the object was sent to echo or a print() - now you can throw the object around anywhere that would cast the object to a string, and have it call the __toString() method:

CODE:

1. // concatenation
2. $string = 'foo'.$barObject;
3.
4. // casting
5. $string = (string) $object;
6.
7. // functions & language constructs
8. // which take strings as arguments
9. try
10. {
11. $foo = new Foo();
12. echo htmlentities($foo);
13. }
14. catch (FooException $e)
15. {
16. die($e);
17. }