cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.1.4 CE setup:di:compile exception

Magento 2.1.4 CE setup:di:compile exception

Hello,

I am running Magento 2.1.4 CE on a CentOS 7.3.1611 machine with php 7.0.15. When I do a setup:di:compile I get an exception and the process stops. This is the error message I get.

 

$ bin/magento setup:di:compile -vvv
Compilation was started.
Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 46.0 MiB

                                                                                                                                                        
  [Exception]                                                                                                                                           
  Notice: Uninitialized string offset: 1 in /var/www/mag/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php on line 322  
                                                                                                                                                        


Exception trace:
 () at /var/www/mag/vendor/magento/framework/App/ErrorHandler.php:61
 Magento\Framework\App\ErrorHandler->handler() at /var/www/mag/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php:322
 Magento\Setup\Module\Di\Code\Reader\FileScanner->scan() at /var/www/mag/vendor/zendframework/zend-code/src/Scanner/TokenArrayScanner.php:134
 Zend\Code\Scanner\TokenArrayScanner->getClassNames() at /var/www/mag/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php:67
 Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList() at /var/www/mag/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php:61
 Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation() at /var/www/mag/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 Magento\Setup\Module\Di\App\Task\Manager->process() at /var/www/mag/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:187
 Magento\Setup\Console\Command\DiCompileCommand->execute() at /var/www/mag/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /var/www/mag/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /var/www/mag/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /var/www/mag/vendor/magento/framework/Console/Cli.php:96
 Magento\Framework\Console\Cli->doRun() at /var/www/mag/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /var/www/mag/bin/magento:23


setup:di:compile


This the header of php -i

$ php -i
phpinfo()
PHP Version => 7.0.15

System => Linux ip-172-18-20-68 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64
Build Date => Feb 10 2017 18:20:22
Configure Command =>  './configure'  '--with-pdo-mysql' '--with-config-file-path=/etc' '--enable-bcmath' '--enable-pdo' '--enable-mysqlnd' '--enable-opcache' '--enable-xml' '--with-mcrypt' '--with-gd' '--enable-intl' '--enable-mbstring' '--enable-json' '--with-iconv' '--mandir=/usr/local/share/man' '--with-apxs2=/bin/apxs' '--with-curl' '--with-openssl' '--with-xsl' '--with-bz2' '--with-zlib' '--enable-zip' '--with-jpeg-dir' '--with-png-dir' '-with-xpm-dir'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20151012
PHP Extension => 20151012
Zend Extension => 320151012
Zend Extension Build => API320151012,NTS
PHP Extension Build => API20151012,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15, Copyright (c) 1999-2017, by Zend Technologies


The offending line in setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php seems to work with tokens. I am not sure where to go from here and would appreciate your help.

 

    317                 // process the name
    318                 if ($infos[$infoIndex]['shortName'] == ''
    319                     && (($this->tokenType === T_CLASS || $this->tokenType === T_INTERFACE || $this->tokenType === T_TRAIT) && $infos[$infoIndex]['type'] === 'class'
    320                         || ($this->tokenType === T_FUNCTION && $infos[$infoIndex]['type'] === 'function'))
    321                 ) {
    322                     $infos[$infoIndex]['shortName'] = $tokens[$tokenIndex + 2][1];
    323                     $infos[$infoIndex]['name'] = (($namespace !== null) ? $namespace . '\\' : '') . $infos[$infoIndex]['shortName'];
    324                 }
    325 

Regards,

Francisco

3 REPLIES 3

Re: Magento 2.1.4 CE setup:di:compile exception

@Voalfnij did you manage to solve this? I've got the same problem.

Re: Magento 2.1.4 CE setup:di:compile exception

Same problem here. Anybody have any insight?

Re: Magento 2.1.4 CE setup:di:compile exception

Same problem here , I'm working on DevBox Magento CE 2.1.7 , After i had installed abraham/twitteroauth vendor dependency  in my module folder by composer.

require_once BP."/vendor/abraham/twitteroauth/autoload.php";

First I got the following Err

PHP Fatal error:  Cannot use object of type Closure as array

then I had tried to include the classes Manually not by autoloader.

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Packt_SweetTweet',
__DIR__
);

//require_once BP."/vendor/abraham/twitteroauth/autoload.php";

require_once __DIR__."/vendor/abraham/twitteroauth/src/Util.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/Request.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/Response.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/Consumer.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/Token.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/TwitterOAuthException.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/SignatureMethod.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/HmacSha1.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/Config.php";
require_once __DIR__."/vendor/abraham/twitteroauth/src/TwitterOAuth.php";

I got that Err.

 


[Exception]                                                                  
  Notice: Uninitialized string offset: 1 in /var/www/magento2/setup/src/Magen  
  to/Setup/Module/Di/Code/Reader/FileScanner.php on line 322                   
                                                             

          

   When I remove my module or the twitteroauth, I can run setup:upgrade & setup:di:compile

As normal.

Can any one help please?. I don't know what is happening.