Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
See xjm's comment in #1463564: Drupal 8 does not work with PHP 5.3.2 (the version shipped with Ubuntu 10.04 LTS). We should not use 'use' statements in install/update files, at least until we're able to display a decent fail message rather than a syntax error.
Comment | File | Size | Author |
---|---|---|---|
#7 | fresh-clone.png | 13.89 KB | xjm |
Comments
Comment #1
catchComment #2
David_Rothstein CreditAttribution: David_Rothstein commentedI'm confused how this happens (but don't have PHP 5.2 handy to test). Stripped of code comments, install.php, for example, looks like this:
There are no "use" statements in this file; those only happen once install.core.inc is loaded. So doesn't the script exit before there is ever a problem?
Comment #3
Crell CreditAttribution: Crell commentedThe use statement doesn't matter. As soon as we hit a namespaced class name instead, there will still be a parse error.
The only alternative would be to only use non-namespaced code in the installer, or portions of the installer, which strikes me as a foolish no-go. We syntax error on PHP 4. By the time Drupal 8 ships, PHP 5.3 will already be in security-only status. 5.2 will be dead dead dead.
(The PHP internals team is stepping up their release schedule, with plans for an actual schedule and scheduled deprecation of older releases rather than the long tail of support as in the past. See https://wiki.php.net/rfc/releaseprocess )
I say this is a won't fix.
Comment #4
catchI'm not sure why it happens either, and also don't have 5.2 to test with, but let's see if there's a simple way to fix it (we already had the same thing with the define() -> const patch and worked around that without killing anyone).
If this is indeed won't fix, then we should remove the attempts to print an error message early altogether, since afaik it should be possible to print the requirements report with 5.3.0 - 5.3.2 without hitting a syntax error.
Comment #5
Crell CreditAttribution: Crell commentedThe only way to bypass those syntax errors, I think, would be for install.php to be something like:
We may be able to get away with that for install and update, but not for index.php since that would be hit on every request.
Comment #6
catchCrell, if you look at install.php, that's more or less what we have already:
I'll ping xjm to see if she still has PHP 5.2 handy to test on.
Comment #7
xjmSorry, I garbled explaining Tim's testing. You get the "nice" error on
update.php
orinstall.php
, but on 5.2 you get a syntax error before you can get redirected there, and on 5.3.2 (per timplunkett) you get a fatal. Who goes directly toinstall.php
when they download Drupal for the first time? Not me. I just go to the folder where I put it.On 5.2:
It's perhaps not quite as bad for upgrading since a lot of people are used to navigating to
update.php
and that's in all our instructions. However, for those that don't, their site is suddenly toast with no feedback. (As above.)That said, I just meant to post an FYI; I wasn't thinking of it as a critical. But if we really want to give people feedback on the version issue when they try to install D8 with old PHP, we'd need to handle
index.php
too.Comment #8
xjmComment #9
catchOh I see, if it's just index.php then this is indeed won't fix. Sorry folks.
Comment #10
klonosI still think we should fix this to present meaningful errors to users in all possible cases. We shouldn't close it, but rather downgrade its critical status instead. This feels like "sweeping under the carpet" to me. It is a reproducible WTF so if it can be fixed, then we should fix it.
Comment #11
xjmYeah, I'd agree. Reopening at normal. Maybe we can't fix it in a sane way, but I don't see the point of having special code in
install.php
andupdate.php
than 90% of users won't see becauseindex.php
blows up on them first.Edit: Especially since the fatal error on 5.3.2 impacts Lucid. (https://wiki.ubuntu.com/LTS)
Comment #12
David_Rothstein CreditAttribution: David_Rothstein commentedSo I agree it would be nice to fix, but it might very well be impossible to without adding code to the critical path that we don't really want there.
I'm pretty sure index.php in Drupal 7 has this problem also (though I can't remember exactly which PHP versions it has it for, maybe only PHP 4 in which case it would be less serious than the problem here).
Comment #13
xjmPatch to fix this for update.php: #1749790: PHP 5.3 detection fails on update
Comment #14
mgiffordThat looks like a huge chunk of the includes/update.core.inc just had to be re-written.
Comment #15
Crell CreditAttribution: Crell commentedI'm going to vote we just won't-fix this issue again, esp. now that we're going all the way to 5.4. Any objections?
Comment #16
Crell CreditAttribution: Crell commentedNo objections, so closing.