Jump to content

Uncaught exception when reporting content if there are restricted moderators


Go to solution Solved by Marc,

Recommended Posts

Posted

To reproduce:

  • Create a moderator with the permissions set to "Restricted", but leave everything checked (the thing that actually matters here is that the "All" checkbox is enabled in the forum selector in the forums tab)
  • (From any user) attempt to report a forum post
  • Observe that you get redirected to an error saying "You have already reported that.", and that the original request returned 500

Stack trace:

TypeError: in_array(): Argument #2 ($haystack) must be of type array, int given (0)
#0 /opt/forum/system/Content/Content.php(1714): in_array()
#1 /opt/forum/init.php(940) : eval()'d code(62): IPS\_Content->report()
#2 /opt/forum/system/Content/Controller.php(3001): IPS\moderation_hook_Content->report()
#3 /opt/forum/system/Content/Controller.php(2271): IPS\Content\_Controller->_report()
#4 /opt/forum/applications/forums/modules/front/forums/topic.php(1240): IPS\Content\_Controller->__call()
#5 /opt/forum/system/Dispatcher/Controller.php(107): IPS\forums\modules\front\forums\_topic->__call()
#6 /opt/forum/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute()
#7 /opt/forum/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute()
#8 /opt/forum/system/Dispatcher/Dispatcher.php(153): IPS\forums\modules\front\forums\_topic->execute()
#9 /opt/forum/index.php(13): IPS\_Dispatcher->run()
#10 {main}

The buggy code is \IPS\Content::report, L1710-1719:

				if ( $canView === TRUE and $container = $item->containerWrapper() and isset( $container::$modPerm ) )
				{
					if ( isset( $perms[ $container::$modPerm ] ) and $perms[ $container::$modPerm ] != '*' )
					{
						if ( ! in_array( $item->mapped('container'), $perms[ $container::$modPerm ] ) )
						{
							$canView = FALSE;
						}
					}
				}

The tag for a moderator with no forum restrictions is -1, not '*':

					if ( isset( $perms[ $container::$modPerm ] ) and $perms[ $container::$modPerm ] != -1 )

 

Posted

Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.

 

  • 2 weeks later...
  • Solution
Posted

Just a quick note to let you know this has been resolved in the latest 4.7.4 release, which went out a short time ago. If you are still experiencing this issue after upgrading to that release, please let us know.

  • 1 month later...
Posted

Dear marc , i got the same error after update to Version 4.7.5

TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given (0)
#0 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/applications/core/sources/Reports/Report.php(223): in_array()
#1 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/system/Helpers/Table/Content.php(560): IPS\core\Reports\_Report::tableGetRows()
#2 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/system/Helpers/Table/Table.php(494): IPS\Helpers\Table\_Content->getRows()
#3 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/applications/core/extensions/core/ModCp/Reports.php(136): IPS\Helpers\Table\_Table->__toString()
#4 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/applications/core/modules/front/modcp/modcp.php(114): IPS\core\extensions\core\ModCp\_Reports->manage()
#5 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/system/Dispatcher/Controller.php(118): IPS\core\modules\front\modcp\_modcp->manage()
#6 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/system/Dispatcher/Dispatcher.php(153): IPS\Dispatcher\_Controller->execute()
#7 /mnt/BLOCKSTORAGE/home/876438.cloudwaysapps.com/fmrvbatayz/public_html/index.php(13): IPS\_Dispatcher->run()
#8 {main}

Could contain: Page, Text, File

Posted

We would need to look further into this for you, however the access details on file appear to be incorrect or missing. Could you please update these details by visiting your client area, selecting the relevant purchase, then clicking "Review/Update Access Information" under the "Stored Access Information" section. 

We look forward to further assisting you. 

 

Posted
16 minutes ago, Stargazers Lounge said:

Has there been a regression on this bug in 4.7.5? It was OK in 4.7.4 but we are not getting report notifications again since upgrading to 4.7.5?

Not getting report notifications is a known issue in 4.7.5 at this time

  • Recently Browsing   0 members

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