cvs: pear /SOAP/Type hexBinary.php
| From: | Jan Schneider | Date: | Tue, 23 Jan 2007 17:25:26 +0000 |
| Subject: | cvs: pear /SOAP/Type hexBinary.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44361@lists.php.net to get a copy of this message | ||
yunosh Tue Jan 23 17:25:26 2007 UTC
Modified files:
/pear/SOAP/Type hexBinary.php
Log:
preg_match is much faster.
http://cvs.php.net/viewvc.cgi/pear/SOAP/Type/hexBinary.php?r1=1.7&r2=1.8&diff_format=u
Index: pear/SOAP/Type/hexBinary.php
diff -u pear/SOAP/Type/hexBinary.php:1.7 pear/SOAP/Type/hexBinary.php:1.8
--- pear/SOAP/Type/hexBinary.php:1.7 Tue Jan 23 16:51:59 2007
+++ pear/SOAP/Type/hexBinary.php Tue Jan 23 17:25:26 2007
@@ -35,8 +35,7 @@
function is_hexbin($value)
{
// First see if there are any invalid chars.
- $l = strlen($value);
- if (!$l || strspn($value, '0123456789ABCDEFabcdef') != $l) {
+ if (!strlen($value) || preg_match('/[^A-Fa-f0-9]/', $value)) {
return false;
}