Compile not working
We have installed weltpixel Backend module in magento 2.4.4 version.but when we have run di compile command getting this errro.
error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = []) must be compatible with Monolog\Logger::info($message, array $context = []): void in /home/eckman/public_html/app/code/WeltPixel/Backend/Model/Logger.php on line 57
Please let me know what we can do it.
-
Official comment
Please install the last version 1.11.1 which is compatible with Magento 2.4.4
Comment actions -
Just need to fix this file as below: WeltPixel\Backend\Model\Logger.php
<?php
namespace WeltPixel\Backend\Model;use Magento\Framework\App\Config\ScopeConfigInterface;
class Logger extends \Magento\Framework\Logger\Monolog
{
const XML_PATH_WELTPIXEL_DEVELOPER_LOGGING = 'weltpixel_backend_developer/logging/disable_broken_reference';/**
* @var ScopeConfigInterface
*/
protected $scopeConfig;/**
* Logger constructor.
* @param ScopeConfigInterface $scopeConfig
* @param string $name
* @param array $handlers
* @param array $processors
*/
public function __construct(ScopeConfigInterface $scopeConfig, string $name, array $handlers = [], array $processors = [])
{
$this->scopeConfig = $scopeConfig;
$handlers = array_values($handlers);parent::__construct($name, $handlers, $processors);
}/**
* Adds a log record at the WARNING level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function warning($message, array $context = []): void
{
$result = $this->_parseLogMessage((string)$message, $context);
if ($result !== false) {
parent::warning((string)$message, $context);
}
$result;
}/**
* Adds a log record at the INFO level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function info($message, array $context = []): void
{
$result = $this->_parseLogMessage((string)$message, $context);
if ($result !== false) {
parent::info((string)$message, $context);
}
$result;
}/**
* @param $message
* @param array $context
* @return Boolean
*/
protected function _parseLogMessage($message, $context)
{
$isLogEnabled = $this->scopeConfig->getValue(self::XML_PATH_WELTPIXEL_DEVELOPER_LOGGING, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
$pos = strpos($message, 'Broken reference');
if (!$isLogEnabled && ($pos !== false) ) {
return false;
}return true;
}
} -
I have already installed/updated to v1.11.1, and am still getting the following error related to php v8.1 incompatibility:
Exception #0 (Exception): Deprecated Functionality: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /app/code/WeltPixel/CmsBlockScheduler/Model/Block.php on line 49
-
I found that updating line 49 in
/app/code/WeltPixel/CmsBlockScheduler/Model/Block.php
to the following fixes the issue:
$block_customerGroupId = explode(',', $this->getCustomerGroup() ?? '');
--
Hopefully you can update the extension so I don't have to override it with an unneeded module.
Thank you - John
-
Hi.
I still receive the same issue after upgrading to Magento 2.4.4 and at the same time theme to 1.11.1
bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------] 11% < 1 sec 169.0 MiBPHP Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = Array) must be compatible with Monolog\Logger::info($message, array $context = Array): void in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/Backend/Model/Logger.php on line 57Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = Array) must be compatible with Monolog\Logger::info($message, array $context = Array): void in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/Backend/Model/Logger.php on line 57
What else can cause this problem?
-
I have also tried all over again and now receiving this after upgrading to 1.11.1 on Magento 2.4.3-p1
[STAG] < public_html > $ bin/magento --version
Magento CLI 2.4.3-p1
[STAG] < public_html > $ bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------] 11% < 1 sec 159.0 MiBPHP Fatal error: Declaration of WeltPixel\SocialLogin\lib\Google\Model::offsetExists(WeltPixel\SocialLogin\lib\Google\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/SocialLogin/lib/Google/Model.php on line 251Fatal error: Declaration of WeltPixel\SocialLogin\lib\Google\Model::offsetExists(WeltPixel\SocialLogin\lib\Google\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/SocialLogin/lib/Google/Model.php on line 251
-
Even with the latest files and patches from the 25 April 2022 Release, composer seems to get stuck on the following...
While running
php bin/magento setup:di:compile
we are getting the following error message:WeltPixel\Backend\Model\Logger Incompatible argument type: Required type: string. Actual type: array; File: app/code/WeltPixel/Backend/Model/Logger.php
Could you please let us know when a bugfix will be available?
Unfortunately, we've already had to apply the following patch to make it PHP 8.1 compatible, but errors remain:
--- app/code/WeltPixel/Backend/Model/Logger.php
+++ app/code/WeltPixel/Backend/Model/Logger.php
@@ -33,37 +33,35 @@
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
- public function warning($message, array $context = array())
+ public function warning($message, array $context = array()): void
{
$result = $this->_parseLogMessage($message, $context);
if ($result !== false) {
- return parent::warning($message, $context);
+ parent::warning($message, $context);
}
- return $result;
}
/**
* Adds a log record at the INFO level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
- public function info($message, array $context = array())
+ public function info($message, array $context = array()): void
{
$result = $this->_parseLogMessage($message, $context);
if ($result !== false) {
- return parent::info($message, $context);
+ parent::info($message, $context);
}
- return $result;
}
/**
* @param $message
* @param array $context
* @return Boolean -
Hi didi you manage to fix this issue?
Fatal error: Declaration of WeltPixel\SocialLogin\lib\Google\Model::offsetExists(WeltPixel\SocialLogin\lib\Google\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/SocialLogin/lib/Google/Model.php on line 251
-
I just installed 1.11.1 of weltpixel/module-google-tag-manager, weltpixel/cmsblockscheduler and weltpixel/m2-weltpixel-backend, but I still receive this error during compilation:
PHP Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = []) must be compatible with Monolog\Logger::info($message, array $context = []): void in /var/www/html/app/code/WeltPixel/Backend/Model/Logger.php on line 57
Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = []) must be compatible with Monolog\Logger::info($message, array $context = []): void in /var/www/html/app/code/WeltPixel/Backend/Model/Logger.php on line 57What can we do about it?
-
I am also getting this problem:
MiBPHP Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = Array) must be compatible with Monolog\Logger::info($message, array $context = Array): void in public_html/app/code/WeltPixel/Backend/Model/Logger.php on line 57
Magento Open Source 2.4.4, version 1.11.1
Any update from support on this?
-
Still cannot compile the site using the standard methods as always, below is the process based on a clean version of the Theme & Files.
- Re-downloaded a fresh copy of the theme files
- logged in as root end deleted all theme / module content to ensure no rogue files
- uploaded the content as the user like always
- uploaded the patch for M2.4 as the user
- re-ran all the standard commands as user to generate static content site-wide
- ran the compile command as user, it fell over on 1/9 on Social Login
- detailed social login
- re-ran all the standard commands as user to generate static content site-wide
- ran the compile command as user, it fell over on 6/9 on WeltPixel Backend
WeltPixel\Backend\Model\Logger Incompatible argument type: Required type: string. Actual type: array; File: /htdocs/app/code/WeltPixel/Backend/Model/Logger.php
Total Errors Count: 1
In Log.php line 92:Cannot progress any further as I can't really delete WeltPixel Backend
Magento 2.4.4
PHP 8.1.7 -
this breaks upgrade for me (was to 2.4.4p1, but then also tried 2.4.5). My error is the same as Ian, Russell and Torben.
[xxxxxx@xxxxx httpdocs]$ php bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/9 [===>------------------------] 11% 1 sec 141.0 MiBPHP Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = Array) must be compatible with Monolog\Logger::info($message, array $context = Array): void in /xxxxxxxxxxxxxxxxxxxxxxxxxx/httpdocs/app/code/WeltPixel/Backend/Model/Logger.php on line 57 -
update for future users, my logger.php file now looks like this:
-------------------------------------------------------------
<?php
namespace WeltPixel\Backend\Model;use Magento\Framework\App\Config\ScopeConfigInterface;
class Logger extends \Magento\Framework\Logger\Monolog
{
}-------------------------
No idea what i've deleted, but it works!
The second issue is social login, which i'm lead to believe there is a patch for, although I don't use it so I deleted it from app/weltpixel and compiled fine after.
-
Fatal error: Declaration of WeltPixel\SocialLogin\lib\Google\Model::offsetExists(WeltPixel\SocialLogin\lib\Google\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) in /home/406848.cloudwaysapps.com/aepaaeysdz/public_html/app/code/WeltPixel/SocialLogin/lib/Google/Model.php on line 251
Help to delete Welt development ??????????/ -
still having the issue in magento 2.4.5-p1
Fatal error: Declaration of WeltPixel\Backend\Model\Logger::info($message, array $context = []) must be compatible with Monolog\Logger::info($message, array $context = []): void in /var/www/html/app/code/WeltPixel/Backend/Model/Logger.php on line 57
-
@Support
I have the same problem, error on line 57.
But, why if i installed 1.11.11 version for Social Login, GTM and Cards, in vendor folder i have for all modules
1.10.17 versions???
and on composer install a i can see 1.11.11
- Installing weltpixel/m2-weltpixel-backend (1.11.11): Extracting archive
- Installing weltpixel/m2-social-login (1.11.11): Extracting archive
- Installing weltpixel/m2-weltpixel-google-cards (1.11.11): Extracting archive
- Installing weltpixel/module-google-tag-manager (1.11.11): Extracting archiveThis is from vendor/weltpixel
{
"name": "weltpixel/m2-weltpixel-backend",
"description": "WeltPixel Backend Module",
"require": {
"magento/module-admin-notification": "*"
},
"type": "magento2-module",
"version": "1.10.17",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"WeltPixel\\Backend\\": ""
}
}
}For PHP 8.1 i have errors with functions that are deprecated...
PS: i got the modules from your website.
-
You can try a different method of installation and see if the error persists:
You have here a user guide: https://support.weltpixel.com/hc/en-us/articles/360020662919-How-to-install-an-extension-in-Magento-2-WeltPixel-Guides
-
I install all my module this way, using composer require and setup:upgrade after.
I removed the vendor folder before composer install.
Your modules are instaled using .zip files.
The same way they use to work for older versions.
"dist": {
"type": "zip",
"url": "modules/WeltPixel_GoogleTagManager.zip"
}But i'm going to try first a
composer clearcache
then see what's going to happen.
UPDATE
Yes, that was the problem.
Please sign in to leave a comment.
Comments
26 comments