OPEN-DSI / ecommerceng_woosync

WooSync, synchronize Woocommerce and Dolibarr
GNU General Public License v3.0
71 stars 46 forks source link

php fatal error : class not found and unparenthesized #61

Open pandreani-opendsi opened 2 years ago

pandreani-opendsi commented 2 years ago

Test avec Dolibarr 16 et PHP 8 (pas d'erreur avec Dolibarr 16 et PHP 7).

Page blanche si on clic pour accéder à la config du module.

Dans les logs apache :

PHP Fatal error: Uncaught Error: Class "eCommerceSite" not found in /var/www/html/doli16/htdocs/custom/ecommerceng_woosync/core/modules/modECommerceNg.class.php:143\nStack trace:\n#0 /var/www/html/doli16/htdocs/admin/modules.php(340): modECommerceNg->__construct()\n#1 {main}\n thrown in /var/www/html/doli16/htdocs/custom/ecommerceng_woosync/core/modules/modECommerceNg.class.php on line 143, referer: http://10.43.47.218/doli16/htdocs/admin/modules.php

PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /var/www/html/doli16/htdocs/custom/ecommerceng/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php on line 3293, referer: http://10.43.47.218/doli16/htdocs/admin/modules.php?mode=commonkanban&search_status=%C3%89tat&search_nature=external

Haschtl commented 2 years ago

Seems to be a bug in /class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php line 3306 (at least with v4.1.16, with your version it may be on line 3293 as your error says) Just replace

$results = isset($results->products) ? $results->products : is_array($results) ? $results : [];

with

$results = isset($results->products) ? $results->products : (is_array($results) ? $results : []);
Haschtl commented 2 years ago

Update: There is another issue when you try to start the sync. Blank page and PHP-errors in the log:

[Sat Sep 17 14:14:45.784026 2022] [proxy_fcgi:error] [pid 280381:tid 140654268569344] [client 185.159.158.51:57156] AH01071: Got error 'PHP message: PHP Warning:  Undefined property: User::$societe_id in /var/www/html/dolibarr/htdocs/custom/ecommerceng/index.php on line 42', referer: https://MY.DOMAIN/core/tools.php?mainmenu=tools&leftmenu=
[Sat Sep 17 14:14:57.745951 2022] [proxy_fcgi:error] [pid 280381:tid 140654268569344] [client 185.159.158.51:57648] AH01071: Got error 'PHP message: PHP Warning:  Undefined property: User::$societe_id in /var/www/html/dolibarr/htdocs/custom/ecommerceng/site.php on line 45PHP message: PHP Warning:  Undefined property: eCommerceRemoteAccessWoocommerce::$error in /var/www/html/dolibarr/htdocs/custom/ecommerceng/class/data/eCommerceRemoteAccess.class.php on line 74PHP message: PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/html/dolibarr/htdocs/custom/ecommerceng/site.php:272\nStack trace:\n#0 {main}\n  thrown in /var/www/html/dolibarr/htdocs/custom/ecommerceng/site.php on line 272', referer: https://MY.DOMAIN/custom/ecommerceng/index.php?idmenu=37&mainmenu=tools&leftmenu=

I'm also using Dolibarr 16 and PHP8

BeMins commented 1 year ago

Hi. Got the same on lline 3428

[Thu Dec 08 10:49:40.320660 2022] [proxy_fcgi:error] [pid 258721:tid 140457862469184] [client ####:61656] AH01071: Got error 'PHP message: PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /var/www/##/billing/htdocs/custom/ecommerceng/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php on line 3428', referer: https://##/admin/modules.php?mode=commonkanban&page_y=2653

Dolibarr 17 and PHP8

freechelmi commented 1 year ago

Hello patrice :-) Maybe you could edit the bug in english language.

I hit the same problem , maybe we should tell explicitly that the plugin is not PHP8 ready

pandreani-opendsi commented 1 year ago

Hello Michel, Thanks for the comment, I'll look at this.

freechelmi commented 1 year ago

You can mark your issue duplicate to #76 to help track