litespeedtech / magento2-LiteSpeed_LiteMage

LiteMage Cache Extension for Magento 2
https://www.litespeedtech.com/products/litespeed-web-cache/litemage
Other
30 stars 10 forks source link

Trying to access array offset on value of type null during bin/magento di:compile #41

Open diazwatson opened 2 months ago

diazwatson commented 2 months ago

After installing this module we and deploy changes we get an error during di compile

task magento:compile
  [production] run command -v 'php' || which 'php' || type -p 'php'
  [production] /usr/local/bin/php
  [production] run /usr/local/bin/php /var/html/releases/231/./bin/magento setup:di:compile
  [production] Compilation was started.
  [production] %message% 0/9 [>---------------------------]   0% < 1 sec 149.0 MiBProxies code generation... 0/9 [>-----------------------]   0% < 1 sec 149.0 MiB
  [production] Proxies code generation... 1/9 [==>---------------------]  11% 1 sec 157.0 MiB
  [production] Repositories code generation... 1/9 [==>------------------]  11% 1 sec 157.0 MiB
  [production] Repositories code generation... 2/9 [====>---------------]  22% 5 secs 436.0 MiB
  [production] Service data attributes generation... 2/9 [===>----------]  22% 5 secs 436.0 MiB
  [production] Application code generator... 3/9 [====>---------]  33% 5 secs 438.5 MiB
  [production] Application code generator... 4/9 [======>-------]  44% 19 secs 470.5 MiB
  [production] Interceptors generation... 4/9 [======>-------]  44% 19 secs 470.5 MiB
  [production] Interceptors generation... 5/9 [=======>------]  55% 37 secs 599.5 MiB
  [production] Area configuration aggregation... 5/9 [=======>------]  55% 37 secs 599.5 MiB
  [production] Area configuration aggregation... 6/9 [=========>----]  66% 43 secs 737.5 MiB
  [production] Interception cache generation... 6/9 [=========>----]  66% 43 secs 737.5 MiB
  [production] Interception cache generation... 7/9 [==========>---]  77% 46 secs 737.5 MiB
  [production] App action list generation... 7/9 [==========>---]  77% 46 secs 737.5 MiB
  [production] Plugin list generation... 8/9 [============>-]  88% 46 secs 737.5 MiB
  [production] Generated code and dependency injection configuration successfully.
  [production] Plugin list generation... 9/9 [==============] 100% 48 secs 737.5 MiB
  [production] In ErrorHandler.php line 62:
  [production]                                                                                
  [production]   Notice: Trying to access array offset on value of type null in 
  [production]   /var/html/releases/231/vendor/litespeed/module-litemage/Model/Config.php o  
  [production]   n line 339
  [production]  error  in magento2.php on line 155:
  [production] exit code 1 (General error)
gz-devops commented 3 weeks ago

Same issue here. Is this module compatible with php8.3? @diazwatson did you fix this?

litespeed-adil commented 3 weeks ago

I tested this on my Magento ver. 2.4.7-p3 on PHP 8.3 and I am unable to reproduce this issue. Please feel free to open a support ticket and we will troubleshoot it.

gz-devops commented 3 weeks ago

@litespeed-adil please double check at your end that php cli is 8.3. In our end if ln -sfn /usr/local/lsws/lsphp83/bin/php /usr/bin/php then php for cli switch to 8.3.10 for magento user.

If ln -sfn /usr/local/lsws/lsphp82/bin/php /usr/bin/php then php for cli switch to 8.2.22

With php 8.2 no error. With php 8.3 error is there just after you run setup:upgrade And it is definitely incompatibly with php 8.3 in this:

/litespeed/module-litemage/Model/Config.php on line 339

$this->load_conf_field_array(self::CFG_CONTEXTBYPASS, $lm['general']);
$this->load_conf_field_array(self::CFG_IGNORED_BLOCKS, $lm['general']);
$this->load_conf_field_array(self::CFG_IGNORED_TAGS, $lm['general']);
litespeed-adil commented 3 weeks ago

My test env is definitely on 8.3

[magento@magento public_html]$ php -v PHP 8.3.13 (cli) (built: Oct 25 2024 00:00:00) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.13, Copyright (c) Zend Technologies

and no matter what I do:

php bin/magento setup:di:compile php bin/magento deploy:mode:set production php bin/magento setup:upgrade

everything completes successfully on my environment. For /litespeed/module-litemage/Model/Config.php on line 339 I will ping our developer to check if the code is compatible with PHP 8.3