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

[4.0] CLI fails if namespace map is not present #26266

Closed
mbabker opened this issue Sep 11, 2019 · 1 comment
Closed

[4.0] CLI fails if namespace map is not present #26266

mbabker opened this issue Sep 11, 2019 · 1 comment

Comments

@mbabker
Copy link
Contributor

mbabker commented Sep 11, 2019

Steps to reproduce the issue

git checkout 4.0-dev
git pull
composer install
rm libraries/autoload_psr4.php
php cli/joomla.php

Expected result

The CLI application can create the libraries/autoload_psr4.php file and it should not require a web request to do so.

Actual result

Michaels-Mac-mini:joomla-cms mbabker$ php cli/joomla.php 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta name="robots" content="noindex,nofollow" />
        <style>                body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
                .container { margin: 30px; max-width: 600px; }
                h1 { color: #dc3545; font-size: 24px; }</style>
    </head>
    <body>
                        <div class="container">
                    <h1>Whoops, looks like something went wrong.</h1>
                </div>
    </body>
</html>

System information (as much as possible)

Git SHA 21c74a1, all other specs are immaterial to this issue

Additional comments

class Exception#133 (8) {
  protected $message =>
  string(27) "Failed to start application"
  private $string =>
  string(0) ""
  protected $code =>
  int(500)
  protected $file =>
  string(57) "/Users/mbabker/Sites/joomla-cms/libraries/src/Factory.php"
  protected $line =>
  int(139)
  private $trace =>
  array(11) {
    [0] =>
    array(6) {
      'file' =>
      string(69) "/Users/mbabker/Sites/joomla-cms/libraries/src/Client/ClientHelper.php"
      'line' =>
      int(42)
      'function' =>
      string(14) "getApplication"
      'class' =>
      string(18) "Joomla\CMS\Factory"
      'type' =>
      string(2) "::"
      'args' =>
      array(0) {
        ...
      }
    }
    [1] =>
    array(6) {
      'file' =>
      string(65) "/Users/mbabker/Sites/joomla-cms/libraries/src/Filesystem/File.php"
      'line' =>
      int(354)
      'function' =>
      string(14) "getCredentials"
      'class' =>
      string(30) "Joomla\CMS\Client\ClientHelper"
      'type' =>
      string(2) "::"
      'args' =>
      array(1) {
        ...
      }
    }
    [2] =>
    array(6) {
      'file' =>
      string(58) "/Users/mbabker/Sites/joomla-cms/libraries/namespacemap.php"
      'line' =>
      int(129)
      'function' =>
      string(5) "write"
      'class' =>
      string(26) "Joomla\CMS\Filesystem\File"
      'type' =>
      string(2) "::"
      'args' =>
      array(2) {
        ...
      }
    }
    [3] =>
    array(6) {
      'file' =>
      string(58) "/Users/mbabker/Sites/joomla-cms/libraries/namespacemap.php"
      'line' =>
      int(75)
      'function' =>
      string(18) "writeNamespaceFile"
      'class' =>
      string(17) "JNamespacePsr4Map"
      'type' =>
      string(2) "->"
      'args' =>
      array(1) {
        ...
      }
    }
    [4] =>
    array(6) {
      'file' =>
      string(58) "/Users/mbabker/Sites/joomla-cms/libraries/namespacemap.php"
      'line' =>
      int(91)
      'function' =>
      string(6) "create"
      'class' =>
      string(17) "JNamespacePsr4Map"
      'type' =>
      string(2) "->"
      'args' =>
      array(0) {
        ...
      }
    }
    [5] =>
    array(6) {
      'file' =>
      string(86) "/Users/mbabker/Sites/joomla-cms/libraries/src/Application/ExtensionNamespaceMapper.php"
      'line' =>
      int(33)
      'function' =>
      string(4) "load"
      'class' =>
      string(17) "JNamespacePsr4Map"
      'type' =>
      string(2) "->"
      'args' =>
      array(0) {
        ...
      }
    }
    [6] =>
    array(6) {
      'file' =>
      string(80) "/Users/mbabker/Sites/joomla-cms/libraries/src/Application/ConsoleApplication.php"
      'line' =>
      int(105)
      'function' =>
      string(27) "createExtensionNamespaceMap"
      'class' =>
      string(41) "Joomla\CMS\Application\ConsoleApplication"
      'type' =>
      string(2) "->"
      'args' =>
      array(0) {
        ...
      }
    }
    [7] =>
    array(6) {
      'file' =>
      string(78) "/Users/mbabker/Sites/joomla-cms/libraries/src/Service/Provider/Application.php"
      'line' =>
      int(105)
      'function' =>
      string(11) "__construct"
      'class' =>
      string(41) "Joomla\CMS\Application\ConsoleApplication"
      'type' =>
      string(2) "->"
      'args' =>
      array(5) {
        ...
      }
    }
    [8] =>
    array(6) {
      'file' =>
      string(84) "/Users/mbabker/Sites/joomla-cms/libraries/vendor/joomla/di/src/ContainerResource.php"
      'line' =>
      int(176)
      'function' =>
      string(37) "Joomla\CMS\Service\Provider\{closure}"
      'class' =>
      string(39) "Joomla\CMS\Service\Provider\Application"
      'type' =>
      string(2) "->"
      'args' =>
      array(1) {
        ...
      }
    }
    [9] =>
    array(6) {
      'file' =>
      string(76) "/Users/mbabker/Sites/joomla-cms/libraries/vendor/joomla/di/src/Container.php"
      'line' =>
      int(96)
      'function' =>
      string(11) "getInstance"
      'class' =>
      string(27) "Joomla\DI\ContainerResource"
      'type' =>
      string(2) "->"
      'args' =>
      array(0) {
        ...
      }
    }
    [10] =>
    array(6) {
      'file' =>
      string(46) "/Users/mbabker/Sites/joomla-cms/cli/joomla.php"
      'line' =>
      int(67)
      'function' =>
      string(3) "get"
      'class' =>
      string(19) "Joomla\DI\Container"
      'type' =>
      string(2) "->"
      'args' =>
      array(1) {
        ...
      }
    }
  }
  private $previous =>
  NULL
  public $xdebug_message =>
  string(1899) "
Exception: Failed to start application in /Users/mbabker/Sites/joomla-cms/libraries/src/Factory.php on line 139

Call Stack:
    0.0017     406832   1. {main}() /Users/mbabker/Sites/joomla-cms/cli/joomla.php:0
    0.1086    4523240   2. Joomla\DI\Container->get() /Users/mbabker/Sites/joomla-cms/cli/joomla.php:67
    0.1086    4523240   3. Joomla\DI\ContainerResource->getInstance() /Users/mbabker/Sites/joomla-cms/libraries/vendor/joomla/di/src/Container.php:96
    0.1086    4523240   4. Joomla\CMS\Service\P"...
}
@wilsonge
Copy link
Contributor

Thankyou! Nice spot. PR at #26272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants