Jump to content

Ambigious If-check in error handling serves no purpose


TSP

Recommended Posts

Posted

I reviewed some changes between 4.4.7 and 4.4.9.2 and found the following change for Output.php, line 658

--- a/public/system/Output/Output.php
+++ b/public/system/Output/Output.php
@@ -658,9 +658,19 @@ class _Output
                        }
                }
 
+               /* Allow this page to be cached by guests? */
+               $allowGuestCache = FALSE;
+               if ( $httpStatusCode == 404 or $httpStatusCode == 403 and ! \IPS\Member::loggedIn()->isBanned() and ! \IPS\Request::i()->ipAddressIsBanned() )
+               {
+                       $allowGuestCache = TRUE;
+               }
+               
+               // Do not cache error pages
+               $allowGuestCache = FALSE;
+

It's in the error-method.

1) You set guest caching to false, then set it to true if it meets certain criterias, then set it to false again. Without doing anything else in between.

Not sure what you want to do, but I guess you either want to remove the last assignment of $allowGuestCache or you want to remove both the if-block and subsequent variable assignment. 

2) EDIT: The if-check is also ambigious.

Should add some parenthesis. For example: 

$httpStatusCode == 404 or ($httpStatusCode == 403 and ! \IPS\Member::loggedIn()->isBanned() and ! \IPS\Request::i()->ipAddressIsBanned())

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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