checkout / checkout-magento2-plugin

Checkout.com Magento 2 official extension
MIT License
32 stars 32 forks source link

Magento 2.4.2 broken debugging #509

Open dio5 opened 2 years ago

dio5 commented 2 years ago

With debugging enabled, I'm getting the error:

TypeError: Argument 2 passed to Monolog\Logger::debug() must be of the type array, string given

Coming from:

$this->logger->additional('authorization header: ' . $key, 'auth');

which calls

$this->logger->debug('Checkout Logging: ', $msg);

in \CheckoutCom\Magento2\Helper\Logger::write

as Monolog\Logger::debug is expecting an array as second argument.

It seems it might just need to be concatenated instead?

    * @param  string $message The log message
     * @param  array  $context The log context
     * @return bool   Whether the record has been processed
     */
    public function debug($message, array $context = array())

(Also slight note on Magento 2.4.4 is using different version than 2.4.3 of Monolog.)

dio5 commented 2 years ago

Although I also notice sometimes arrays are passed to \CheckoutCom\Magento2\Helper\Logger::additional so will need better fixing than concat.