Jump to content

[BUG 4.7.7] Recounting a member's reputation from ACP throws an exception


Go to solution Solved by Daniel F,

Recommended Posts

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 by teraßyte
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...