title: preg_match(): Compilation failed: invalid range in character class at offset
body: <p>Thank you in advance for you time in helping with this issue.. </p>
  
  <blockquote>
    <p>preg_match(): Compilation failed: invalid range in character class at offset 20 session.php on line 278</p>
  </blockquote>
  
  <p>This stopped working all of a sudden after months of working, after a PHP upgrade on our server.</p>
  
  <p>Here is the code</p>
  
  <pre><code>    else{
       /* Spruce up username, check length */
       $subuser = stripslashes($subuser);
       if(strlen($subuser) &lt; $config['min_user_chars']){
          $form-&gt;setError($field, "* Username below ".$config['min_user_chars']."characters");
       }
       else if(strlen($subuser) &gt; $config['max_user_chars']){
          $form-&gt;setError($field, "* Username above ".$config['max_user_chars']."characters");
       }
  
  
       /* Check if username is not alphanumeric */
      /* PREG_MATCH CODE */
  
       else if(!preg_match("/^[a-z0-9]([0-9a-z_-\s])+$/i", $subuser)){        
          $form-&gt;setError($field, "* Username not alphanumeric");
       }
  
  
      /* PREG_MATCH CODE */
  
  
       /* Check if username is reserved */
       else if(strcasecmp($subuser, GUEST_NAME) == 0){
          $form-&gt;setError($field, "* Username reserved word");
       }
       /* Check if username is already in use */
       else if($database-&gt;usernameTaken($subuser)){
          $form-&gt;setError($field, "* Username already in use");
       }
       /* Check if username is banned */
       else if($database-&gt;usernameBanned($subuser)){
          $form-&gt;setError($field, "* Username banned");
       }
    }
  </code></pre>