sage-installer
sage-installer copied to clipboard
PHP cURL extension missing as required dependency
- [x] I've read the guidelines for Contributing to Roots Projects
- [x] This request isn't a duplicate of an existing issue
- [x] I've read the docs and followed them (if applicable)
- [x] This is not a personal support request that should be posted on the Roots Discourse community
Description
The curl PHP extension is missing from the required dependencies, hence when the curl PHP extension is not available (like Ubuntu 20 with base PHP 7.4 package installed), a fatal PHP exception is caused when symfony/console
is used:
PHP Fatal error: Uncaught Error: Call to undefined function Roots\Sage\Installer\Console\Commands\curl_init() in /home/build/src/test/sage/vendor/roots/sage-installer/src/Console/Commands/PresetCommand.php:72
Stack trace:
#0 /home/build/src/test/sage/vendor/symfony/console/Command/Command.php(255): Roots\Sage\Installer\Console\Commands\PresetCommand->execute()
#1 /home/build/src/test/sage/vendor/illuminate/console/Command.php(166): Symfony\Component\Console\Command\Command->run()
#2 /home/build/src/test/sage/vendor/roots/sage-installer/src/Console/Commands/Command.php(47): Illuminate\Console\Command->run()
#3 /home/build/src/test/sage/vendor/symfony/console/Application.php(1009): Roots\Sage\Installer\Console\Commands\Command->run()
#4 /home/build/src/test/sage/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#5 /home/build/src/test/sage/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#6 /home/build/src/test/sage/vendor/roots/sage-ins in /home/build/src/test/sage/vendor/roots/sage-installer/src/Console/Commands/PresetCommand.php on line 72
Steps to reproduce
- Use a system that has no PHP cURL extension yet installed/activated, e.g. an Ubuntu 20 system with PHP base package, but not the
php7.4-curl
package. - Install the
symfony/console
package (can be any version at time of writing as the latest version doesn't require the PHP cURL extension) usingcomposer
. - Use
symfony/console
,
Expected behavior:
The PHP cURL extension should be required, composer
should stop installing and list it as required PHP extension (as it already does with PHP extensions).
Alternative/additionally the code should check for the presence of the curl_init
function and throw an appropriate exception (PHP cURL extension is missing.
).
Actual behavior:
composer
deems the dependencies for this package satisfied and the installation as successful.
Using the package results in a PHP exception.
Reproduces how often: As long as the PHP cURL extension is missing the error will occur.
Versions
Latest Sage 9.x.
Additional information
Similarissue with Sage 10.x that uses roots/acorn
as it also uses curl
but without requiring the curl
binary or checking for its presence/availability on the PHP installation.