Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upN°3253 Fix setup crashing on incompatible PHP versions #155
Conversation
|
J'aime bien l'idée de protéger le setup contre un problème de PHP, mais est-ce qu'on peut pas faire un truc plus simple et qui permettrait aussi de se protéger contre une installation où PHP ne fonctionne même pas? Je pensais à une page index.php qui soit essentiellement du HTML avec juste la détection de version de PHP qui produirait un markup qu'on vérifie en JS. Si c'est bon, on passe à la page du setup proprement-dit, sinon on affiche (toujours en JS) un message indiquant que PHP n'est pas configuré ou n'est pas la bonne version... |
|
Thanks Denis for the feedback, your solution is simplier indeed : a simple index that generated a string in PHP, and controlling what was generated server side by a JS code. Implementing this we shouldn't forget to check also PHP version (maybe generate a |
|
Php expose it's version through this collection of constants: Ie: PHP_VERSION |
9188208
to
a802264
a802264
to
1d65073
piRGoif commentedAug 14, 2020
•
edited
Context
A couple of time after adding some PHP code in iTop core, we saw that the setup cannot be launched anymore when using old PHP versions.
Some past examples :
ormLinkSet(commit b58a084 in iTop 2.8.0 dev version) broke setup for PHP < 7.1.0Setup homepage error
Sample error when opening the setup with an incompatible PHP version :
We should instead display a clear message stating that the current PHP version is incompatible with iTop !
Risks
Proposition
This PR propose a lightweight setup index that will first check PHP version. This new index page includes the bare minimum files to avoid PHP parse errors.
If the test succeeds the setup is launched, without changing the browser's URL.
If not an error message is displayed.
Refactorings
Two new files were created, they are the only dependencies for the new setup/index.php :
The below constants/methods were moved/introduced :