Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Unsupported operand types: string / int (societe.class.php:2370) #26205

Open
grti-fr opened this issue Oct 12, 2023 · 5 comments
Labels
Bug This is a bug (something does not work as expected)

Comments

@grti-fr
Copy link

grti-fr commented Oct 12, 2023

Bug

I can't add "absolute discount" (remise fixe) because of an error 500.

Similar to #23713

The problem occurs in all of my Dolibarr instances, even in my fresh install from 18.0.1

Error in PHP logs :

Uncaught TypeError: Unsupported operand types: string / int in /htdocs/societe/class/societe.class.php:2370
Stack trace:
#0 /htdocs/comm/remx.php(180): Societe->set_remise_except()
#1 {main}
  thrown in /home/htdocs/societe/class/societe.class.php on line 2370

Environment Version

18.0.1, 18.0.2

Environment OS

o2switch

Environment Web server

No response

Environment PHP

8.1.23

Environment Database

mysql

Environment URL(s)

No response

Expected and actual behavior

No response

Steps to reproduce the behavior

Try to add an absolute discount for a customer

Attached files

No response

@grti-fr grti-fr added the Bug This is a bug (something does not work as expected) label Oct 12, 2023
@eluos
Copy link

eluos commented Oct 15, 2023

Getting the same error on Dolibarr v18.0.2 when adding a new currency.

Fatal error: Uncaught TypeError: Unsupported operand types: string + int in X:------------\htdocs\admin\dict.php:863 Stack trace: #0 {main} thrown in X:-------\htdocs\admin\dict.php on line 863

@AurelienBISOTTI
Copy link

AurelienBISOTTI commented Oct 27, 2023

Many functions are affected.

The bug only appears on PHP8 instances + Dolibarr v18 (I didn’t notice it elsewhere)

I’ve found two solutions:

  • Remain in PHP8 and fill in all form fields (put 0 instead of an empty field)
  • Downgrade to PHP7

Edit : also submited a fix in code. Waiting for approval

AurelienBISOTTI added a commit to AurelienBISOTTI/dolibarr that referenced this issue Oct 27, 2023
…nt and string

Dolibarr#26205

Happends with Dolibarr v18 + PHP8

This issue exists with many functions : 

Examples :
https://www.dolibarr.org/forum/t/bom-error-500-uncaught-typeerror-unsupported-operand-types-string-int/24196/3
I had it with invoice => loan => make payment
And also in bank reconciliation
@Lovinity
Copy link

Many functions are affected.

The bug only appears on PHP8 instances + Dolibarr v18 (I didn’t notice it elsewhere)

I’ve found two solutions:

  • Remain in PHP8 and fill in all form fields (put 0 instead of an empty field)
  • Downgrade to PHP7

Edit : also submited a fix in code. Waiting for approval

FYI the first workaround above does not work when adding an absolute discount. A downgrade to PHP 7 is necessary in that case unless you are able to manually add entries into the database (not recommended especially for log keeping).

@grti-fr
Copy link
Author

grti-fr commented Oct 28, 2023

Thank you all for your replies. I've downgraded PHP to 7.4 and it works fine again.

@nealjoos
Copy link
Contributor

Same error here on Dolibarr version 19.0.2 using PHP version 8.1.28 when adding an absolute discount. Is there a solution other than downgrading to PHP 7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

5 participants