mike                                     Wed, 12 May 2010 09:37:25 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299277

Log:
Fixed bug #51725 (xmlrpc_get_type() returns true on invalid dates). (Mike)

Bug: http://bugs.php.net/51725 (Verified) xmlrpc_get_type() returns true on 
invalid dates
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/date/php_date.c
    U   php/php-src/trunk/ext/date/php_date.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-12 07:05:47 UTC (rev 299276)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-12 09:37:25 UTC (rev 299277)
@@ -46,6 +46,7 @@

 - Fixed bug #51732 (Fileinfo __construct or open does not work with NULL).
   (Pierre)
+- Fixed bug #51725 (xmlrpc_get_type() returns true on invalid dates). (Mike)
 - Fixed bug #51723 (Content-length header is limited to 32bit integer with
   Apache2 on Windows). (Pierre)
 - Fixed bug #51721 (mark DOMNodeList and DOMNamedNodeMap as Traversable).

Modified: php/php-src/branches/PHP_5_3/ext/date/php_date.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/php_date.c    2010-05-12 07:05:47 UTC 
(rev 299276)
+++ php/php-src/branches/PHP_5_3/ext/date/php_date.c    2010-05-12 09:37:25 UTC 
(rev 299277)
@@ -1362,10 +1362,16 @@
 PHPAPI signed long php_parse_date(char *string, signed long *now)
 {
        timelib_time *parsed_time;
+       timelib_error_container *error = NULL;
        int           error2;
        signed long   retval;

-       parsed_time = timelib_strtotime(string, strlen(string), NULL, 
DATE_TIMEZONEDB);
+       parsed_time = timelib_strtotime(string, strlen(string), &error, 
DATE_TIMEZONEDB);
+       if (error->error_count) {
+               timelib_error_container_dtor(error);
+               return -1;
+       }
+       timelib_error_container_dtor(error);
        timelib_update_ts(parsed_time, NULL);
        retval = timelib_date_to_int(parsed_time, &error2);
        timelib_time_dtor(parsed_time);

Modified: php/php-src/trunk/ext/date/php_date.c
===================================================================
--- php/php-src/trunk/ext/date/php_date.c       2010-05-12 07:05:47 UTC (rev 
299276)
+++ php/php-src/trunk/ext/date/php_date.c       2010-05-12 09:37:25 UTC (rev 
299277)
@@ -1361,10 +1361,16 @@
 PHPAPI signed long php_parse_date(char *string, signed long *now)
 {
        timelib_time *parsed_time;
+       timelib_error_container *error = NULL;
        int           error2;
        signed long   retval;

-       parsed_time = timelib_strtotime(string, strlen(string), NULL, 
DATE_TIMEZONEDB);
+       parsed_time = timelib_strtotime(string, strlen(string), &error, 
DATE_TIMEZONEDB);
+       if (error->error_count) {
+               timelib_error_container_dtor(error);
+               return -1;
+       }
+       timelib_error_container_dtor(error);
        timelib_update_ts(parsed_time, NULL);
        retval = timelib_date_to_int(parsed_time, &error2);
        timelib_time_dtor(parsed_time);

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

Reply via email to