iliaa           Tue Nov 11 21:58:39 2003 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/standard/tests/time    bug26198.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       parsedate.y 
  Log:
  MFH: Fixed bug #26198 (strtotime() handling of M/F Y date format).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.464 php-src/NEWS:1.1247.2.465
--- php-src/NEWS:1.1247.2.464   Sun Nov  9 23:33:55 2003
+++ php-src/NEWS        Tue Nov 11 21:58:36 2003
@@ -3,6 +3,7 @@
 ?? ??? 2003, Version 4.3.5
 - Fixed header handler in NSAPI SAPI module (header->replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26198 (strtotime() handling of M/F Y date format). (Ilia)
 - Fixed bug #26176 (Fixed handling of numeric keys in INI files). (Ilia)
 - Fixed bug #26168 (shtool availability check in phpize). 
   (robbat2 at gentoo dot org, Ilia)
Index: php-src/ext/standard/parsedate.y
diff -u php-src/ext/standard/parsedate.y:1.34.2.2 
php-src/ext/standard/parsedate.y:1.34.2.3
--- php-src/ext/standard/parsedate.y:1.34.2.2   Mon Jul 28 00:02:55 2003
+++ php-src/ext/standard/parsedate.y    Tue Nov 11 21:58:37 2003
@@ -8,7 +8,7 @@
 **  This code is in the public domain and has no copyright.
 */
 
-/* $Id: parsedate.y,v 1.34.2.2 2003/07/28 04:02:55 iliaa Exp $ */
+/* $Id: parsedate.y,v 1.34.2.3 2003/11/12 02:58:37 iliaa Exp $ */
 
 #include "php.h"
 
@@ -308,7 +308,11 @@
        }
        | tMONTH tUNUMBER {
            ((struct date_yy *)parm)->yyMonth = $1;
-           ((struct date_yy *)parm)->yyDay = $2;
+           if ($2 > 1000) {
+               ((struct date_yy *)parm)->yyYear = $2;
+           } else {
+               ((struct date_yy *)parm)->yyDay = $2;
+           }
        }
        | tMONTH tUNUMBER ',' tUNUMBER {
            ((struct date_yy *)parm)->yyMonth = $1;
@@ -317,7 +321,11 @@
        }
        | tUNUMBER tMONTH {
            ((struct date_yy *)parm)->yyMonth = $2;
-           ((struct date_yy *)parm)->yyDay = $1;
+           if ($1 > 1000) {
+               ((struct date_yy *)parm)->yyYear = $1;
+           } else {
+               ((struct date_yy *)parm)->yyDay = $1;
+           }
        }
        | tUNUMBER tMONTH tUNUMBER {
            ((struct date_yy *)parm)->yyMonth = $2;

Index: php-src/ext/standard/tests/time/bug26198.phpt
+++ php-src/ext/standard/tests/time/bug26198.phpt
--TEST--
Bug #26198 (strtotime handling of "M Y" and "Y M" format)
--FILE--
<?php
        echo date("F Y\n", strtotime("Oct 2001"));
        echo date("M Y\n", strtotime("2001 Oct"));
?>
--EXPECT--
October 2001
Oct 2001

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to