Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted November 4, 20222 yr I see the following error a lot in our system logs after updating from PHP 7.4 to 8.1: TypeError: in_array(): Argument #2 ($haystack) must be of type array, int given (0) #0 /*/system/Content/Content.php(1714): in_array(300, -1) #1 /*/system/Content/Controller.php(3001): IPS\_Content->report('', '2') #2 /*/system/Content/Controller.php(2271): IPS\Content\_Controller->_report('IPS\\forums\\Topi...', Object(IPS\forums\Topic\Post), Object(IPS\forums\Topic)) #3 /*/applications/forums/modules/front/forums/topic.php(1240): IPS\Content\_Controller->__call('_report', Array) #4 /*/system/Dispatcher/Controller.php(107): IPS\forums\modules\front\forums\_topic->__call('reportComment', Array) #5 /*/system/Content/Controller.php(50): IPS\Dispatcher\_Controller->execute() #6 /*/applications/forums/modules/front/forums/topic.php(39): IPS\Content\_Controller->execute() #7 /*/system/Dispatcher/Dispatcher.php(153): IPS\forums\modules\front\forums\_topic->execute() #8 /*/index.php(13): IPS\_Dispatcher->run() #9 {main} This TypeError doesn't prevent the report from being submitted, but it causes a redirect in the browser (because of an ajax call not receiving the expected reply) to the report page for the content, where the user will be told they've already reported it. In Content.php at or around line 1714: <?php if ( ! in_array( $item->mapped('container'), $perms[ $container::$modPerm ] ) ) As seen in the error pasted above, the first parameter was 300 (referring to the forum id), while the second parameter supplied is -1. The value of $container::$modPerm is "forums", and the value of $perms['forums'] is just -1. This is because, while the moderator or moderator groups is restricted, they are unrestricted in which forums they are able to operate, and then you save it as -1 to the forums-key in the json value for the perms-column in ibf_core_moderators.
November 5, 20222 yr No apology necessary, and it's the reason we have our support set up the way it is. Glad you found an answer to your issue. 😉