1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed "break" missing in a switch loop

Discussion in 'Resource Manager Resolved Bugs' started by cclaerhout, Nov 3, 2014.

  1. cclaerhout

    cclaerhout Well-Known Member

    Class: XenResource_Search_DataHandler_Update
          case 'resprefix':
             if (
               return array(
    'metadata' => array('resprefix'preg_split('/\D+/'strval($constraintInfo))),

    The $constraintInfo has no reason not to be there, but since there's a conditional, a break would be safer.
  2. cclaerhout

    cclaerhout Well-Known Member

    I'm going to take the opportunity of the above post to ask if there's any reason to use a preg_split instead of an explode since the constraintInfo have been created/checked from the input using an implode with a blank space just a little above in the code?
  3. Mike

    Mike XenForo Developer Staff Member

    This happened in the post data handler as well, so I've fixed that too.

    As for the preg_split, it's probably unnecessary in the default code, but from my reading, the constraints aren't guaranteed to be filtered particularly well, so it is more defensive than just a plain explode.
    cclaerhout likes this.

Share This Page