Skip to content
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

Replace ext name spaces with dashes (as composer does when storing) #8513

Merged
merged 1 commit into from
Feb 25, 2017
Merged

Replace ext name spaces with dashes (as composer does when storing) #8513

merged 1 commit into from
Feb 25, 2017

Conversation

AydinHassan
Copy link
Contributor

@AydinHassan AydinHassan commented Feb 10, 2017

When trying to run setup:install with the PHP extension opcache set as a composer requirement, magento will fail with (even if it is installed):

Missing following extensions: 'zend-opcache'

Exception trace:
 () at /var/www/setup/src/Magento/Setup/Model/Installer.php:484
 Magento\Setup\Model\Installer->checkExtensions() at n/a:n/a
 call_user_func_array() at /var/www/setup/src/Magento/Setup/Model/Installer.php:344
 Magento\Setup\Model\Installer->install() at /var/www/setup/src/Magento/Setup/Console/Command/InstallCommand.php:125
 Magento\Setup\Console\Command\InstallCommand->execute() at /var/www/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /var/www/vendor/magento/framework/Console/Cli.php:96
 Magento\Framework\Console\Cli->doRun() at /var/www/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/bin/magento:23

This is because spaces are not being replaced with dashes as composer does for extensions: https://github.com/composer/composer/blob/master/src/Composer/Repository/PlatformRepository.php#L296

Note that the opcache extension does have spaces in it's name Zend OPcache:

www-data@8e57bf8de2d5:~$ php -a
Interactive shell

php > var_dump(get_loaded_extensions());
php shell code:1:
array(45) {
  [0] =>
  string(4) "Core"
  [1] =>
  string(4) "date"
  [2] =>
  string(6) "libxml"
  [3] =>
  string(7) "openssl"
  [4] =>
  string(4) "pcre"
  [5] =>
  string(7) "sqlite3"
  [6] =>
  string(4) "zlib"
  [7] =>
  string(5) "ctype"
  [8] =>
  string(4) "curl"
  [9] =>
  string(3) "dom"
  [10] =>
  string(8) "fileinfo"
  [11] =>
  string(6) "filter"
  [12] =>
  string(3) "ftp"
  [13] =>
  string(4) "hash"
  [14] =>
  string(5) "iconv"
  [15] =>
  string(4) "json"
  [16] =>
  string(8) "mbstring"
  [17] =>
  string(3) "SPL"
  [18] =>
  string(3) "PDO"
  [19] =>
  string(7) "session"
  [20] =>
  string(5) "posix"
  [21] =>
  string(8) "readline"
  [22] =>
  string(10) "Reflection"
  [23] =>
  string(8) "standard"
  [24] =>
  string(9) "SimpleXML"
  [25] =>
  string(10) "pdo_sqlite"
  [26] =>
  string(4) "Phar"
  [27] =>
  string(9) "tokenizer"
  [28] =>
  string(3) "xml"
  [29] =>
  string(9) "xmlreader"
  [30] =>
  string(9) "xmlwriter"
  [31] =>
  string(7) "mysqlnd"
  [32] =>
  string(9) "blackfire"
  [33] =>
  string(6) "bcmath"
  [34] =>
  string(2) "gd"
  [35] =>
  string(4) "intl"
  [36] =>
  string(6) "mcrypt"
  [37] =>
  string(6) "mysqli"
  [38] =>
  string(5) "pcntl"
  [39] =>
  string(9) "pdo_mysql"
  [40] =>
  string(4) "soap"
  [41] =>
  string(3) "xsl"
  [42] =>
  string(3) "zip"
  [43] =>
  string(12) "Zend OPcache"
  [44] =>
  string(6) "xdebug"
}

I'm not sure how to test this as it's not possible to mock get_loaded_extensions() without dodgy namespace hacks. Any suggestions?

@okorshenko okorshenko self-assigned this Feb 16, 2017
@okorshenko okorshenko added this to the February 2017 milestone Feb 16, 2017
Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Some more sophisticated/extensible mechanism like https://github.com/symfony/requirements-checker/blob/master/src/SymfonyRequirements.php#L338 would do the job better here but until then at least having current mechanism workable in all cases is a real must.

@okorshenko
Copy link
Contributor

@AydinHassan thank you for your contribution!
@orlangur thank you for review and feedback

@AydinHassan AydinHassan deleted the replace-ext-space-with-dash branch February 26, 2017 11:43
@vrann vrann added the simple label Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants