PHP warning

in_array() expects parameter 2 to be array, string given

/home/forge/dev.relionbattery.com/craft/plugins/comments/services/Comments_SettingsService.php(58)

46 
47         // Do we even have any settings setup? By default - anything can be commented on
48         if ($permissions) {
49             if (isset($permissions[$element->classHandle])) {
50                 if ($permissions[$element->classHandle] != '*') {
51                     // Check for various elements
52                     if ($element->classHandle == 'Entry') {
53                         $id = $element->section->id;
54                     } else {
55                         $id = $element->group->id;
56                     }
57 
58                     if (!in_array($id, $permissions[$element->classHandle])) {
59                         return false;
60                     }
61                 }
62             }
63 
64             // Check for individual element permissions
65             // foreach ($element->content->attributes as $key => $value) {
66             //     $field = craft()->fields->getFieldByHandle($key);
67 
68             //     if ($field['type'] == 'Comments') {
69             //         if (isset($value['commentEnabled'])) {
70             //             if (!$value['commentEnabled']) {

Stack Trace

#0
+
 /home/forge/dev.relionbattery.com/craft/app/etc/web/WebApp.php(694): CApplication->handleError(2, "in_array() expects parameter 2 to be array, string given", "/home/forge/dev.relionbattery.com/craft/plugins/comments/service...", 58)
689         if (version_compare(PHP_VERSION, '7.1', '>=') && strpos($message, 'Narrowing occurred during type inference. Please file a bug report') !== false)
690         {
691             return;
692         }
693 
694         parent::handleError($code, $message, $file, $line);
695     }
696 
697     /**
698      * Raised right AFTER the application processes the request.
699      *
#2
+
 /home/forge/dev.relionbattery.com/craft/plugins/comments/services/Comments_SettingsService.php(58): in_array("4", "")
53                         $id = $element->section->id;
54                     } else {
55                         $id = $element->group->id;
56                     }
57 
58                     if (!in_array($id, $permissions[$element->classHandle])) {
59                         return false;
60                     }
61                 }
62             }
63 
#3
+
 /home/forge/dev.relionbattery.com/craft/plugins/comments/variables/CommentsVariable.php(64): Craft\Comments_SettingsService->checkPermissions(Craft\EntryModel)
59         $html = craft()->templates->render($templateFile, $variables);
60 
61         craft()->path->setTemplatesPath($oldPath);
62 
63         // Finally - none of this matters if the permission to comment on this element is denied
64         if (!craft()->comments_settings->checkPermissions($element)) {
65             return false;
66         }
67 
68         return new \Twig_Markup($html, craft()->templates->getTwig()->getCharset());
69     }
2024-03-29 15:42:14 nginx/1.22.1 / Craft CMS 2.9.2