[PATCH] removed Date_Calc dependency on PCRE
| From: | Roman Neuhauser | Date: | Sat, 19 Jul 2003 17:33:47 +0000 |
| Subject: | [PATCH] removed Date_Calc dependency on PCRE | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-18437@lists.php.net to get a copy of this message | ||
1. this was the only preg_*() call in the whole file
2. is_numeric() does the same job, even faster
--
If you cc me or remove the list(s) completely I'll most likely ignore
your message. see http://www.eyrie.org./~eagle/faqs/questions.html
Index: Date/Date/Calc.php =================================================================== RCS file: /repository/pear/Date/Date/Calc.php,v retrieving revision 1.13 diff -u -u -r1.13 Calc.php --- Date/Date/Calc.php 21 Jun 2003 09:45:51 -0000 1.13 +++ Date/Date/Calc.php 19 Jul 2003 17:25:23 -0000 @@ -90,11 +90,7 @@ $year = Date_Calc::dateNow('%Y'); } - if (strlen($year) != 4) { - return false; - } - - if (preg_match('/\D/',$year)) { + if (strlen($year) != 4 || !is_numeric($year)) { return false; }
Index: Date/Date/Calc.php =================================================================== RCS file: /repository/pear/Date/Date/Calc.php,v retrieving revision 1.13 diff -u -u -r1.13 Calc.php --- Date/Date/Calc.php 21 Jun 2003 09:45:51 -0000 1.13 +++ Date/Date/Calc.php 19 Jul 2003 17:25:23 -0000 @@ -90,11 +90,7 @@ $year = Date_Calc::dateNow('%Y'); } - if (strlen($year) != 4) { - return false; - } - - if (preg_match('/\D/',$year)) { + if (strlen($year) != 4 || !is_numeric($year)) { return false; }