The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Fatal error when pa...
 
Notifications
Clear all

Bug [Solved] Fatal error when passing WP_User to getUser_by(), introduced in recent update

7 Posts
4 Users
3 Reactions
898 Views
(@omriamos)
Posts: 3
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#10716]

Hi,

After updating to the latest version of wpDiscuz (updated on my site two days ago), I encountered a fatal PHP error:

Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, WP_User given in /wp-includes/class-wp-user.php:218

After some debugging, I tracked it down to this line in your plugin:

get_user_by("email", $idOrEmail); // in WpdiscuzHelper.php, line 1116

In some cases, $idOrEmail is actually a WP_User object, which causes get_user_by() to fail since it expects a string, not an object.

🔧 Temporary Fix

I modified the getUserNameAndEmail() function inside class.WpdiscuzHelper.php to properly handle the case where $idOrEmail is a WP_User object:

} elseif ($idOrEmail instanceof WP_User) {
$nameAndEmail = [
"name" => $idOrEmail->display_name,
"email" => $idOrEmail->user_email,
"isUser" => 1,
"user_id" => $idOrEmail->ID,
];
}

This resolved the issue completely.

Just wanted to report this so it can be patched in the next update. Thanks for your great work and support!


 
Posted : 24/06/2025 1:31 pm
Asti
 Asti
(@asti)
Posts: 8267
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi,

We'll check and get back to you ASAP. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 24/06/2025 2:33 pm
(@nubchenkon)
Posts: 2
New Member
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

I have the same fatal error on the site when trying to create or edit a post.


 
Posted : 24/06/2025 5:24 pm
(@tensionmouse)
Posts: 14
Eminent Member
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Same issue here, fatal error when attempting to create or edit a post. Is there a way to move back to v7.6.30 in the meantime?

 

Screenshot 2025 06 24 at 9.12.50 AM

 
Posted : 24/06/2025 6:03 pm
(@tensionmouse)
Posts: 14
Eminent Member
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Thanks @omriamos for the fix, confirming it works!


 
Posted : 24/06/2025 6:14 pm
Asti
 Asti
(@asti)
Posts: 8267
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hi @tensionmouse, @nubchenkon

The issue is fixed, please update the wpDiscuz to the latest version (v. 7.6.32), clear all kinds of caches and check again. 


In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 24/06/2025 11:31 pm
nubchenkon reacted
(@nubchenkon)
Posts: 2
New Member
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@asti updated, everything works.
Thank you for your promptness.


 
Posted : 25/06/2025 12:00 am