1

It appears impossible to submit an invoice from M2 admin. I get the error message: "X We can't save the invoice right now.".

I checked the exception log and I see below errors:

    [2018-02-15 13:44:02] main.CRITICAL: Exception: Warning: Illegal string offset 'ID' in /home/my_username/domains/my_domain.com.nl/public_html/lib/mpdf/classes/cssmgr.php on line 1302 in /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 /home/my_username/domains/my_domain.com.nl/public_html/lib/mpdf/classes/cssmgr.php(1302): Magento\Framework\App\ErrorHandler->handler(2, 'Illegal string ...', '/home/my_username/...', 1302, Array)
#1 /home/my_username/domains/my_domain.com.nl/public_html/lib/mpdf/mpdf.php(15961): cssmgr->MergeCSS('BLOCK', 'BODY', '')
#2 /home/my_username/domains/my_domain.com.nl/public_html/lib/mpdf/mpdf.php(31556): mPDF->WriteHTML('<img src='http:...')
#3 /home/my_username/domains/my_domain.com.nl/public_html/app/code/Cis/Pdfpackage/Model/Observer/OrderStatusChanged.php(237): pdfGenerate('<img src='http:...', 'var/pdfs/000000...')
#4 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Cis\Pdfpackage\Model\Observer\OrderStatusChanged->execute(Object(Magento\Framework\Event\Observer))
#5 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Cis\Pdfpackage\Model\Observer\OrderStatusChanged), Object(Magento\Framework\Event\Observer))
#6 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#7 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('sales_order_sav...', Array)
#8 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Model/AbstractModel.php(802): Magento\Framework\Event\Manager\Proxy->dispatch('sales_order_sav...', Array)
#9 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Model/ResourceModel/Db/VersionControl/AbstractDb.php(56): Magento\Framework\Model\AbstractModel->afterSave()
#10 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(408): Magento\Framework\Model\ResourceModel\Db\VersionControl\AbstractDb->processAfterSaves(Object(Magento\Sales\Model\Order))
#11 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-sales/Model/ResourceModel/Order.php(174): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Magento\Sales\Model\Order))
#12 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Sales\Model\ResourceModel\Order->save(Object(Magento\Sales\Model\Order))
#13 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Sales\Model\ResourceModel\Order\Interceptor->___callParent('save', Array)
#14 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\M...', 'save', Object(Magento\Sales\Model\ResourceModel\Order\Interceptor), Array, 'clean_cache')
#15 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Cache/FlushCacheByTags.php(71): Magento\Sales\Model\ResourceModel\Order\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Sales\Model\Order))
#16 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Sales\Model\ResourceModel\Order\Interceptor), Object(Closure), Object(Magento\Sales\Model\Order))
#17 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Sales/Model/ResourceModel/Order/Interceptor.php(39): Magento\Sales\Model\ResourceModel\Order\Interceptor->___callPlugins('save', Array, Array)
#18 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Model/AbstractModel.php(631): Magento\Sales\Model\ResourceModel\Order\Interceptor->save(Object(Magento\Sales\Model\Order))
#19 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/DB/Transaction.php(129): Magento\Framework\Model\AbstractModel->save()
#20 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-sales/Controller/Adminhtml/Order/Invoice/Save.php(192): Magento\Framework\DB\Transaction->save()
#21 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save/Interceptor.php(24): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save->execute()
#22 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Action/Action.php(102): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor->execute()
#23 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#24 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#25 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor->___callParent('dispatch', Array)
#26 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor), Array, 'adminAuthentica...')
#27 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#28 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#29 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Sales\\C...', 'dispatch', Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor), Array, 'adminMassaction...')
#30 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#31 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#32 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save/Interceptor.php(39): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor->___callPlugins('dispatch', Array, Array)
#33 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/FrontController.php(55): Magento\Sales\Controller\Adminhtml\Order\Invoice\Save\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#34 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#35 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#36 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#37 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#38 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#39 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#40 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#41 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#42 /home/my_username/domains/my_domain.com.nl/public_html/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#43 {main} [] []
[2018-02-15 13:46:44] main.CRITICAL: Magento\Framework\View\Asset\File\NotFoundException: Unable to get content for 'frontend/Magento/luma/nl_NL/Cis_Comment/js/custom.min.js' in /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/File.php:165
Stack trace:
#0 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/MergeStrategy/Direct.php(73): Magento\Framework\View\Asset\File->getContent()
#1 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/MergeStrategy/Direct.php(52): Magento\Framework\View\Asset\MergeStrategy\Direct->composeMergedContent(Array, Object(Magento\Framework\View\Asset\File))
#2 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/MergeStrategy/FileExists.php(44): Magento\Framework\View\Asset\MergeStrategy\Direct->merge(Array, Object(Magento\Framework\View\Asset\File))
#3 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/Merged.php(97): Magento\Framework\View\Asset\MergeStrategy\FileExists->merge(Array, Object(Magento\Framework\View\Asset\File))
#4 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Asset/Merged.php(157): Magento\Framework\View\Asset\Merged->initialize()
#5 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Page/Config/Renderer.php(358): Magento\Framework\View\Asset\Merged->rewind()
#6 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Page/Config/Renderer.php(251): Magento\Framework\View\Page\Config\Renderer->renderAssetHtml('<script  type="...', Object(Magento\Framework\View\Asset\Merged))
#7 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Page/Config/Renderer.php(226): Magento\Framework\View\Page\Config\Renderer->renderAssetGroup(Object(Magento\Framework\View\Asset\PropertyGroup))
#8 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Page/Config/Renderer.php(99): Magento\Framework\View\Page\Config\Renderer->renderAssets(Array)
#9 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Result/Page.php(235): Magento\Framework\View\Page\Config\Renderer->renderHeadContent()
#10 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/View/Result/Layout.php(164): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#11 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#12 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#13 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-varnish-...')
#14 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-page-cache/Model/Controller/Result/VarnishPlugin.php(74): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#15 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\Controller\Result\VarnishPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#16 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'renderResult', Object(Magento\Framework\View\Result\Page\Interceptor), Array, 'result-builtin-...')
#17 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/module-page-cache/Model/Controller/Result/BuiltinPlugin.php(67): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#18 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\Controller\Result\BuiltinPlugin->aroundRenderResult(Object(Magento\Framework\View\Result\Page\Interceptor), Object(Closure), Object(Magento\Framework\App\Response\Http\Interceptor))
#19 /home/my_username/domains/my_domain.com.nl/public_html/var/generation/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#20 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#21 /home/my_username/domains/my_domain.com.nl/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#22 /home/my_username/domains/my_domain.com/public_html/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#23 {main} [] []

Anybody has a clue of what is going wrong here and/or what could be done to correct?

  • Yes. the specified exception code tries to access an element of an array with a key that does not exist $array['key_that_does_not_exist'] in your case the key is ID – vitoriodachef Feb 15 '18 at 14:25
  • @Vulpea: How could I correct this? Is it a setting? A bug? Something with M2.1? – Els den Iep Feb 15 '18 at 14:33
  • What changes did you make between when it was working and the point that it stoped working ? – vitoriodachef Feb 15 '18 at 14:36
  • You could try to remove pub/static var/cache var/generation var/di and run php bin/magento setup:di:compile and then php bin/magento setup:static-content:deploy the second error being a missing js file – vitoriodachef Feb 15 '18 at 14:39
  • BTW The changes that I made since it stopped, is settin up the cron job. – Els den Iep Feb 15 '18 at 14:57
1

So I did a little digging around.

The error points to the fact that you are using an external library mpdf . Others have encountered your problem when using mpdf and PHP 7.1

https://github.com/mpdf/mpdf/issues/278

According to that thread they have fixed it in their latest release (At least that is what I make of it) You could consider upgrading mpdf to the latest stable version and see you have that problem anymore.

A quicker solution (This feels somehow dirty) is to go directly to this file lib/mpdf/classes/cssmgr.php on line 1302 and encapsulate the instructions starting with the accessing of an array element with the key of ID.

e.g

   // the file and line specified above 
    if(isset($some_array['ID']){ // added line here
      ...
      //code that already exists
      .. 
    } //added line here. 

Also if you already have the latest version of mpdf you might consider raising and issue with them on github. If you go with the latter (poking directly into the code) you'll have to remember to do that in production as well and whenever necesary (after updates or at reinstall).

  • Thanks. That might be a step towards a solution. I had noticed myself that the PHP version was pobably triggering the error. I didn't think of mpdf, though. Let me check and I will report back. – Els den Iep Feb 19 '18 at 8:32
  • It is clearly stated in the exception that the problem resides in the mpdf library. – vitoriodachef Feb 19 '18 at 9:20
  • I have credited your answer as the correct/useful answer. Thanks. – Els den Iep Feb 20 '18 at 19:57
  • Did you manage to fix your problem? – vitoriodachef Feb 20 '18 at 20:25
  • Thanks for asking. I am very close, I think. Will let you know. – Els den Iep Feb 20 '18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.