[PHP 8.1] Fatal error:Uncaught TypeError:Unsupported operand types: string + int [PHP 8.1] Fatal error:Uncaught TypeError:Unsupported operand types: string + int
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[PHP 8.1] Fatal error:Uncaught TypeError:Unsupported operand types: string + int

Started by Grimlok, December 29, 2022, 10:49:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Grimlok

Been stumped with this problem the past couple of days. I'm on CPG 1.6.20, bridged with a MyBB forum. I've been getting this message sporadically:

Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /home/XXXXX/public_html/gallery/bridge/mybb.inc.php:170 Stack trace: #0 /home/XXXXX/public_html/gallery/bridge/udb_base.inc.php(170): cpg_udb->get_groups(Array) #1 /home/XXXXX/public_html/gallery/bridge/udb_base.inc.php(89): core_udb->load_user_data(Array) #2 /home/XXXXX/public_html/gallery/include/init.inc.php(252): core_udb->authenticate() #3 /home/XXXXX/public_html/gallery/index.php(22): require('/home/XXXXX/...') #4 {main} thrown in /home/XXXXX/public_html/gallery/bridge/mybb.inc.php on line 170

1. How do I update mybb.inc.php so that the string + int operation in line 170 proceeds successfully? As far as I can tell this is now disallowed in PHP 8.1.
2. I only get this message from time to time; otherwise my gallery works fine. When I do get the error, I'm able to resolve it by logging out and logging back in. That's weird to me - since I'm running a bridged gallery, shouldn't logging out and back in trigger the unsupported operation in the bridge file everytime I do it? Yet it works.

Joe Carver

Do you see any warnings if you turn on Debug / Notices that might show a hint of potential trouble?

I don't use bridging, but could take a look at the file and anything more known would help.

Grimlok

Turning on debug mode with notices, the only warnings that pop up are related to /include/functions.inc.php.

/include/functions.inc.php
Warning line 3613: Trying to access array offset on value of type null
Warning line 3615: Trying to access array offset on value of type null
Warning line 3634: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3613: Trying to access array offset on value of type null
Warning line 3615: Trying to access array offset on value of type null
Warning line 3634: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3613: Trying to access array offset on value of type null
Warning line 3615: Trying to access array offset on value of type null
Warning line 3634: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3649: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3659: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3679: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null
Warning line 3688: Trying to access array offset on value of type null


Quote from: Joe Carver on December 30, 2022, 01:01:13 AM
I don't use bridging, but could take a look at the file and anything more known would help.

Thank you for the offer. I use the standard mybb.inc.php bridge file, and have the following site structure:

domain.com/forums
domain.com/gallery

The problem started appearing after I updated to PHP 8.1 - I was on PHP 7.4 before. And it's triggered when Coppermine attempts to retrieve the groups which the current user is a part of - in the function in question, an integer (100) is added to a string.

Let me know if you can think of anything else.