teraßyte Posted February 12, 2023 Share Posted February 12, 2023 (edited) Recounting a member's reputation from a profile in ACP makes the code throw this exception: Whoops\Exception\ErrorException thrown with message "Object of class IPS\Db\Select could not be converted to int" Stacktrace: #11 Whoops\Exception\ErrorException in /dev47/system/Member/Member.php:1334 #10 Whoops\Run:handleError in /dev47/system/Member/Member.php:1334 #9 IPS\_Member:get_pp_reputation_points in /dev47/system/Patterns/ActiveRecord.php:335 #8 IPS\Patterns\_ActiveRecord:__get in /dev47/system/Member/Member.php:3509 #7 IPS\_Member:apiOutput in /dev47/applications/core/extensions/core/MemberSync/System.php:426 #6 IPS\core\extensions\core\MemberSync\_System:onProfileUpdate in /dev47/system/Member/Member.php:4033 #5 IPS\_Member:memberSync in /dev47/system/Member/Member.php:442 #4 IPS\_Member:save in /dev47/init.php:935 #3 IPS\_Member:recountReputation in /dev47/init.php:935 #2 IPS\core\modules\admin\members\_members:recountReputation in /dev47/system/Dispatcher/Controller.php:107 #1 IPS\Dispatcher\_Controller:execute in /dev47/system/Dispatcher/Dispatcher.php:153 #0 IPS\_Dispatcher:run in /dev47/init.php:935 The issue comes from the code below in /system/Member/Member.php on lines 3821-3830: /** * Recounts reputation for this member * * @return void */ public function recountReputation() { $this->pp_reputation_points = \IPS\Db::i()->select( 'SUM(rep_rating)', 'core_reputation_index', array( 'member_received=?', $this->member_id ) ); $this->save(); } Simply adding ->first() in the query fixes it: $this->pp_reputation_points = \IPS\Db::i()->select( 'SUM(rep_rating)', 'core_reputation_index', array( 'member_received=?', $this->member_id ) )->first(); Edited February 12, 2023 by teraßyte Afrodude and SJ77 2 Link to comment Share on other sites More sharing options...
ThunderBlue Posted February 12, 2023 Share Posted February 12, 2023 Hello. I tried single user recalculation from admincp and got no errors. I also tried with multiple users and no error. No reports in the logs. Are you using this modification by any chance? Link to comment Share on other sites More sharing options...
Jim M Posted February 12, 2023 Share Posted February 12, 2023 See potential of a dev path here but have to ask if this is running 4.7.7. Unfortunately, on my test instance, I am unable to reproduce this. Link to comment Share on other sites More sharing options...
teraßyte Posted February 12, 2023 Author Share Posted February 12, 2023 18 minutes ago, Jim M said: See potential of a dev path here but have to ask if this is running 4.7.7. Unfortunately, on my test instance, I am unable to reproduce this. Yes, it's version 4.7.7 with IN_DEV mode enabled. PHP 8.0.23 in case it helps. I'll run some more tests later to see if I can pinpoint better why it's happening. Link to comment Share on other sites More sharing options...
Solution Daniel F Posted February 12, 2023 Solution Share Posted February 12, 2023 Thanks, I can reproduce it and it's fixed now for an upcoming release. Jim M 1 Link to comment Share on other sites More sharing options...
Recommended Posts