We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Pro Search issue on Latest EE7.5.17 / PHP8.3.25.

Development and Programming

Rob Allen's avatar
Rob Allen
3,106 posts
3 months ago
Rob Allen's avatar Rob Allen

Pro Search having a bit of a tantrum. Latest EE7.5.17 / PHP8.3.25.

  1. Saving pro Search settings gives me an error

Warning foreach() argument must be of type array|object, bool given ee/ExpressionEngine/Addons/pro_search/mcp.pro_search.php, line 527

  • Severity: E_WARNING

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

  • Severity: E_WARNING

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

  • Severity: E_WARNING

@tomjaeger @robin

       
User DhyurnTL's avatar
User DhyurnTL
3 posts
3 months ago
User DhyurnTL's avatar User DhyurnTL

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

🐾

       
Rob Allen's avatar
Rob Allen
3,106 posts
3 months ago
Rob Allen's avatar Rob Allen

Thanks Gaving, sounds logical. I’ll put it in Git later today whne I’ve woken up properly!

       
Rob Allen's avatar
Rob Allen
3,106 posts
3 months ago
Rob Allen's avatar Rob Allen

Added to Github as an issue

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.