Pro Search having a bit of a tantrum. Latest EE7.5.17 / PHP8.3.25.
Warning foreach() argument must be of type array|object, bool given ee/ExpressionEngine/Addons/pro_search/mcp.pro_search.php, line 527
Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120) ee/legacy/core/Input.php, line 261
Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120) ee/legacy/libraries/Functions.php, line 470
@tomjaeger @robin
Line 527 in mcp.pro_search.php is as follows:
foreach (ee()->input->post('permissions') as $perm) {For this to generate the error reported, ee()->input->post('permissions') is returning neither an array nor an object, and so there is nothing for the foreach loop to do anything with.
ee()->input->post('permissions') returns ‘false’ when the item requested is not found in the $_POST array, and my guess is that this is why you are getting the error seen: probably the permissions variable in the form being processed when Pro Search is trying to save its settings (which is the purpose of the method the line appears in) is missing.
Why the permissions input is missing is another thing, and I have nothing useful to observe on that.
That you are getting this error looks like lazy programming in EE: you should not use a function return in a setting such as an foreach loop definition if there is a plausible chance it won’t return the correct type of variable - a better solution would be for the method to get the value of ee()->input->post('permissions') first and set it into a local variable, and then only go on with the foreach loop after checking that the local variable contains an array or an object.
I’d file a bug for this in EE Git - whatever the cause of the missing ‘permissions’ input, the code should not be setup as it is and throw this kind of error.
HTH
🐾
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.