Permalink
Browse files

Change regex to faster ctype functions

  • Loading branch information...
acidvertigo committed May 25, 2011
1 parent 9f5e284 commit 3dfa2b545531a3d57d360631735b9fc2fbc13d86
Showing with 2 additions and 2 deletions.
  1. +2 −2 catalog/includes/functions/general.php
@@ -1111,9 +1111,9 @@ function tep_create_random_value($length, $type = 'mixed') {
$char = chr(tep_rand(0,255));
}
if ($type == 'mixed') {
- if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
+ if (ctype_alnum($char)) $rand_value .= $char;
} elseif ($type == 'chars') {
- if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
+ if (ctype_alpha($char)) $rand_value .= $char;
} elseif ($type == 'digits') {
if (preg_match('/^[0-9]$/i', $char)) $rand_value .= $char;
}

0 comments on commit 3dfa2b5

Please sign in to comment.