6

We are using Magento ver. 2.1.3, when browsing website, error report is generated with full of warnings and website is halted with Error log records.

  1. I have added below code in Index.php but not working.

    error_reporting(E_ERROR | E_PARSE);
    
  2. These warnings are from core modules for example

Warning: array_merge(): Argument #2 is not an array in vendor\magento\module-page-cache\Model\Layout\LayoutPlugin.php on line 71

  1. If we solve one, then it is logged with new one.

  2. Can any one suggest me how can i solve this ?

  3. How the core code does exists with warnings ?

1 Answer 1

3

The Magento error handler converts warnings into exceptions:

https://github.com/magento/magento2/blob/2.1/lib/internal/Magento/Framework/App/ErrorHandler.php

But as you can seee in this code, it respects the error reporting settings. So your setting in index.php does not take effect.

That is because Magento sets it to E_ALL in https://github.com/magento/magento2/blob/2.1/app/bootstrap.php#L10

You try to adjust it there, but the right way to go really is to fix the warnings. They tell you that something is wrong.

3
  • 1
    But it seems as per the post the warnings are getting generated from core code, can we suppress them as well or report to Magento.
    – ImranSheik
    Commented Dec 20, 2016 at 15:39
  • @fschmengler thanks, if i use error_reporting(E_ALL ^ E_WARNING) in app/bootstrap.php, then site is not throwing any errors. But as above comment, how the core code is returning warnings. This issue is very strange to me. Commented Dec 20, 2016 at 16:07
  • 1
    That does not mean that the core code is at fault. I assume there is invalid input data from an extension or theme, for example errors in XML code. Commented Dec 20, 2016 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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