Jump to content

\IPS\Member\Group::groups() issues


SoftwareFactory
 Share

Go to solution Solved by bfarber,

Recommended Posts

On 11/20/2019 at 11:17 AM, Daniel F said:

Hi,

your app has a huge flaw affecting everybody who's using crons.

Quote

RuntimeException(LOCATION_UNKNOWN)

#0 /var/www/html/m284926/system/Member/Member.php(154): IPS\_Session::i()
#1 /var/www/html/m284926/system/Member/Group.php(115): IPS\_Member::loggedIn()
#2 /var/www/html/m284926/system/Member/Group.php(138): IPS\Member\_Group::getStore()
#3 /var/www/html/m284926/applications/brilliantdiscord/extensions/core/Queue/MassSynchronization.php(39): IPS\Member\_Group::groups(true, false)

 

The exception above has been recently reported to me, it can occur when using \IPS\Member\Group::groups() in tasks executed by cron. In \IPS\Member\Group::getStore() i found the following code:

		if ( !isset( \IPS\Data\Store::i()->groups ) )
		{
			\IPS\Data\Store::i()->groups = iterator_to_array( \IPS\Db::i()->select( 'core_groups.*', 'core_groups', NULL, 'core_sys_lang_words.word_custom' )->join( 'core_sys_lang_words', array( "lang_id=? AND word_app=? AND word_key=CONCAT( 'core_group_', core_groups.g_id )", \IPS\Member::loggedIn()->language()->id, 'core' ) )->setKeyField( 'g_id' ) );
		}
		#                                                                                                                                                                                                                                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I could (and I will do it of course) stop using \IPS\Member\Group::groups() in tasks, but using currently logged in member language to sort groups alphabetically and saving it in datastore (it's used also for members than may use a different language) doesn't look like a desired behavior.

Edited by SoftwareFactory
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...