However, you do this without throwing an Exception - you only return out of the function. This means that if a system is already running with some packages installed and the PHP version gets switched to >= 5.3.0, < 5.3.4 (e.g. because you are moving to another server but haven't checked its environment), you might suddenly get fatal errors from missing classes and the like, because you do a simple
return;
here in the initialization. This makes it difficult for the yet unknowing developer to find out why suddenly these fatal errors occur, since there is no indication, since the initial check in the config.php only checks for PHP 5.3, but not for PHP 5.3.4.
At the very least the aforementioned PHP check in config.php should simply be changed from
if (version_compare(PHP_VERSION, '5.3', '<')) {
trigger_error('Composer client requires PHP 5.3, even with Contao 2.11', E_USER_ERROR);
return;
}
define('COMPOSER_MIN_PHPVERSION', '5.3.4');
define('COMPOSER_DIR_RELATIVE', 'composer');
define('COMPOSER_DIR_ABSOULTE', TL_ROOT . '/' . COMPOSER_DIR_RELATIVE);
to
define('COMPOSER_MIN_PHPVERSION', '5.3.4');
define('COMPOSER_DIR_RELATIVE', 'composer');
define('COMPOSER_DIR_ABSOULTE', TL_ROOT . '/' . COMPOSER_DIR_RELATIVE);
if (version_compare(PHP_VERSION, COMPOSER_MIN_PHPVERSION, '<')) {
trigger_error('Composer client requires PHP 5.3, even with Contao 2.11', E_USER_ERROR);
return;
}
In
/system/modules/!composer/config/config.php#L18
you check for the minimum PHP version:However, later on in other functions, you check for a more specific PHP version:
e.g. here and here.
However, you do this without throwing an Exception - you only return out of the function. This means that if a system is already running with some packages installed and the PHP version gets switched to
>= 5.3.0, < 5.3.4
(e.g. because you are moving to another server but haven't checked its environment), you might suddenly get fatal errors from missing classes and the like, because you do a simplehere in the initialization. This makes it difficult for the yet unknowing developer to find out why suddenly these fatal errors occur, since there is no indication, since the initial check in the
config.php
only checks for PHP5.3
, but not for PHP5.3.4
.At the very least the aforementioned PHP check in
config.php
should simply be changed fromto
Then it will always be clear.