Skip to content

setup:di:compile crashes if class found which extends \Magento\Setup\Module\Di\Compiler\Log\Writer\Console  #8497

@tzsolti

Description

@tzsolti

When extending \Magento\Setup\Module\Di\Compiler\Log\Writer\Console in your own module, it will crash the DI compiler.

Preconditions

I tried both with Magento CE 2.1.3 and 2.1.4, the same problem occurred with both. In both cases I used the zip file provided by the Magento website.

Steps to reproduce

  1. Create and enable a module
  2. Create a php class which extends \Magento\Setup\Module\Di\Compiler\Log\Writer\Console
  3. Run in the CLI: php magento setup:di:compile

Expected result

ubuntu:# php magento setup:di:compile
Compilation was started.
Interception cache generation... 7/7 [============================] 100% 40 secs 242.0 MiBBMiB
Generated code and dependency injection configuration successfully.

Actual result

ubuntu:# php magento setup:di:compile
Compilation was started.
Area configuration aggregation... 5/7 [====================>-------] 71% 26 secs 168.0 MiBPHP Fatal error: Uncaught Error: Cannot use object of type Symfony\Component\Console\Output\ConsoleOutput as array in /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/ArgumentsResolver.php:196
Stack trace:
#0 [internal function]: Magento\Setup\Module\Di\Compiler\ArgumentsResolver->Magento\Setup\Module\Di\Compiler{closure}(Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/ArgumentsResolver.php(201): array_map(Object(Closure), Array)
#2 /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/ArgumentsResolver.php(92): Magento\Setup\Module\Di\Compiler\ArgumentsResolver->getConfiguredArguments('Something\Foo\M...')
#3 /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/Config/Reader.php(121): Magento\Setup\Module\Di\Compiler\ArgumentsResolver->getResolvedConstructorArguments('Something\Foo\M...', Array)
#4 /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/Config/Reader.php(89): Magento\Setup\Module\Di\Com in /var/www/html/_2.1.3/setup/src/Magento/Setup/Module/Di/Compiler/ArgumentsResolver.php on line 196

Easy reproduction

I've attached a sample module with which the problem can be reproduced:
Something_Foo.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: needs update

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions