-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail more gracefully when upgrading on PHP 5.x - 5.16 backport #162
Conversation
This version requirement officially went up to PHP 7.0 circa Civi 5.14. However, at that time, the upgrade metadata was kept at PHP 5.6 to allow somewhat softer landing for stragglers. That's no longer possible in Civi 5.16+, This just gives a clearer error when someone tries to upgrade with PHP 5.x. Before ------ When accessing a Civi-WordPress site on PHP 5.6 (or running wp-cli), the Civi class-loader fails to initialize. ``` Parse error: syntax error, unexpected ':', expecting '{' in /Users/totten/bknix/build/dmaster/web/sites/all/modules/civicrm/vendor/league/csv/src/functions.php on line 33 ``` (Approximate call-path: `civicrm.php` => `civicrm.settings.php` => `CRM_Core_ClassLoader` => `vendor/autoload.php` => `vendor/league/csv/src/functions.php`) After ----- When accessing a Civi-WordPress site on PHP 5.6 (or running wp-cli), the error message is: ``` CiviCRM requires PHP version 7.0.0 or greater. You are running PHP version 5.6.38 ``` Comments -------- The canonical representation of the minimum PHP version is in `$civicrm_root/CRM/Upgrade/Form.php`. However, correctly reading that metadata requires loading `civicrm.settings.php`, which triggers the crash. To work around this, this patch reproduces the constant and uses a unit-test to ensure its continued accuracy.
@totten here is the backport PR |
Danke schoen. |
@totten Just a pedantic note to say that it would be nice to have a docblock for the Also, when using |
@christianwach good points. Once this is merged against master let's do a cleanup PR. While this solves the immediate regression your changes should be made. |
@christianwach - Oh, yup, very good. :) I'll post a PR on For the sprintf bit - thanks, I'd never seen that notation before. I suppose that makes |
@totten Absolutely. WordPress uses this notation liberally - random example here. FWIW, the comment My go-to resource is this article which is old but still valid. Not ashamed to say that I refer to it regularly! HTH :) |
Backport #161
This version requirement officially went up to PHP 7.0 circa Civi 5.14. However, at that time, the upgrade metadata was kept at PHP 5.6 to allow somewhat softer landing for stragglers. That's no longer possible in Civi 5.16+,
This just gives a clearer error when someone tries to upgrade with PHP 5.x.