3

Below error showing in php version 7.0.6 Installation time of magento version 2.2.4

Fatal error: Cannot use Magento\Payment\Gateway\ConfigInterface as ConfigInterface because the name is already in use in C:\xampp\htdocs\m224\vendor\magento\module-payment\Model\Method\Logger.php on line 8
3

Seems like Magento 2.2.4 bug, because in the current namespace the ConfigInterface already exists:

enter image description here

so fix should be made in the core files :( Try to report this on the github.

Update:

Here the fix for it https://github.com/magento/magento2/commit/a7d4180ce61a7e9027befefac4ef4af6333ee8ff

Source: https://github.com/magento/magento2/issues/12180#issuecomment-372574834

Another way to fix this issue is to use PHP >= 7.1.

Source: Getting error on installing magento 2.2.4

  • 1
    There are more of these issues, so by now you should use a recent PHP version to solve it, i.e. 7.0.13 or higher. Note that I had the same issue on a 7.1-rc version – Fabian Schmengler Oct 10 '18 at 10:53
0

Its Magento 2.2.4 default bug, you can edit the file code as given below. Please note that

use Magento\Payment\Gateway\ConfigInterface;

is updated to

use Magento\Payment\Gateway\ConfigInterface as LoggerConfigInterface;

and used accordingly.

<?php
 /**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Payment\Model\Method;

use Magento\Payment\Gateway\ConfigInterface as LoggerConfigInterface;
use Psr\Log\LoggerInterface;

/**
 * Class Logger for payment related information (request, response, etc.) which is used for debug.
 *
 * @api
 * @since 100.0.2
 */
class Logger
{
    const DEBUG_KEYS_MASK = '****';

/**
 * @var LoggerInterface
 */
protected $logger;

/**
 * @var LoggerConfigInterface
 */
private $config;

/**
 * @param LoggerInterface $logger
 * @param LoggerConfigInterface $config
 */
public function __construct(
    LoggerInterface $logger,
    LoggerConfigInterface $config = null
) {
    $this->logger = $logger;
    $this->config = $config;
}

/**
     * Logs payment related information used for debug
     *
     * @param array $data
     * @param array|null $maskKeys
     * @param bool|null $forceDebug
     * @return void
     */
    public function debug(array $data, array $maskKeys = null, $forceDebug = null)
    {
        $maskKeys = $maskKeys !== null ? $maskKeys : $this->getDebugReplaceFields();
        $debugOn = $forceDebug !== null ? $forceDebug : $this->isDebugOn();
        if ($debugOn === true) {
            $data = $this->filterDebugData(
                $data,
                $maskKeys
            );
            $this->logger->debug(var_export($data, true));
        }
    }
    /**
     * Returns configured keys to be replaced with mask
     *
     * @return array
     */
    private function getDebugReplaceFields()
    {
        if ($this->config && $this->config->getValue('debugReplaceKeys')) {
            return explode(',', $this->config->getValue('debugReplaceKeys'));
        }
        return [];
    }
    /**
     * Whether debug is enabled in configuration
     *
     * @return bool
     */
    private function isDebugOn()
    {
        return $this->config && (bool)$this->config->getValue('debug');
    }
    /**
     * Recursive filter data by private conventions
     *
     * @param array $debugData
     * @param array $debugReplacePrivateDataKeys
     * @return array
     */
    protected function filterDebugData(array $debugData, array $debugReplacePrivateDataKeys)
    {
        $debugReplacePrivateDataKeys = array_map('strtolower', $debugReplacePrivateDataKeys);
        foreach (array_keys($debugData) as $key) {
            if (in_array(strtolower($key), $debugReplacePrivateDataKeys)) {
                $debugData[$key] = self::DEBUG_KEYS_MASK;
            } elseif (is_array($debugData[$key])) {
                $debugData[$key] = $this->filterDebugData($debugData[$key], $debugReplacePrivateDataKeys);
            }
        }
        return $debugData;
    }
}
  • Showing Error ---> [2018-06-18 09:30:38] main.CRITICAL: Default website is not defined {"exception":"[object] (DomainException(code: 0): Default website is not defined at C:\\xampp\\htdocs\\m224\\vendor\\magento\\module-store\\Model\\WebsiteRepository.php:144)"} [] – Jugal Kishor Jun 18 '18 at 9:32

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.