[wp-hackers] php -v

Andrew Nacin wp at andrewnacin.com
Fri Nov 8 17:43:31 UTC 2013


On Fri, Nov 8, 2013 at 11:53 AM, Baki Goxhaj <banago at gmail.com> wrote:

> WordPress won't become that App platform that you can build anything on
> which Matt presented as the future of WP in WPSF unless the system makes
> use of the new goodness of PHP.


Yeah, no. Nothing is preventing *you* from using newer features you enjoy.
But WordPress core will continue with its minimum requirements for some
time. As John Blackbourn summarized, there are some niceties in PHP 5.3,
5.4, and 5.5, but nothing in them provide a benefit that would outweigh
literally abandoning a half (or more) of our userbase on old software,
unable to ever update WordPress again. (FWIW, since I saw this question was
asked: I don't think it's just a few hosting companies keeping most of our
userbase on 5.2.17. Bluehost, which is huge, recently pushed their servers
from 5.2 to 5.4, and the needle barely moved.)

 * short array syntax, ?:, <?=, function array dereferencing, empty()
supporting arbitrary expressions, etc. are syntactical sugar — they're
nice, but not something to abandon our users for
  * generators, traits, and late static bindings are cool, but their use
cases are fairly limited, you can architect things differently to work
around the lack of them, and they're not something to abandon our users for
 * closures are also cool, but they can largely be replaced by functions
and methods, and they also don't have much of a role in our hooks system
(as a closure attached to a hook can't easily be removed later)
 * namespaces aren't backwards compatible so we won't be able to leverage
them much anyway
 * it's about time PHP 5.5 added finally to try/catch, but we don't
currently use exceptions in WordPress
 * we already use spl_object_hash() when it is available (and it basically
always is, SPL is nearly never disabled)
 * we *could* do SPL autoloading for 5.3+ (and manual includes for 5.2) but
I've tried it and didn't see a performance benefit (happy to be proven
wrong)
 * we already have a solid password hashing mechanism, and we'd likely just
adopt/wrap the 5.5 one at a later point

Would it be "cooler" if we could use 5.3, 5.4, and 5.5 features/syntax/etc?
Absolutely. But 5.2 isn't what PHP 4 was. It's actually pretty decent and
does the job we've asked of it. I think we've been doing this all wrong.
Pushing 5.3+ for the purposes of developer happiness isn't going to get us
anywhere. We had some PHP 5.2-only features (for example, timezone support
and oEmbed XML handling) back when our minimum requirement was PHP 4, but
as Ryan McCue pointed out, I've yet to actually see something of
consequence for which we'd need PHP 5.3+.

If it's not developer happiness, then what is it? I'd argue performance,
stability, and security. We've been leaning on hosting companies and will
continue to do so because it's going to be better for them for these
reasons. Unfortunately, a lot of other software (not named WordPress) break
terribly on 5.3 or 5.4, so the hosts are in a tough spot, as they don't
want to break sites. The rise of WordPress-specific hosts — and
WordPress-specific hosting plans within larger hosting companies — actually
improves the chances that hosting companies will move faster, because
WordPress works on all modern versions of PHP without much issue.

Nacin


More information about the wp-hackers mailing list