]> granicus.if.org Git - php/commitdiff
MFB51: fixed zts build
authorIlia Alshanetsky <iliaa@php.net>
Tue, 29 Nov 2005 23:10:48 +0000 (23:10 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 29 Nov 2005 23:10:48 +0000 (23:10 +0000)
ext/date/php_date.c
ext/date/php_date.h

index 7b4f672463cc9b09a4dd631dee340f1568246abd..73d9c0c884cc659ad8dc68219df61eec11a51f5f 100644 (file)
@@ -34,6 +34,7 @@
 function_entry date_functions[] = {
        PHP_FE(strtotime, NULL)
        PHP_FE(date, NULL)
+       PHP_FE(idate, NULL)
        PHP_FE(gmdate, NULL)
        PHP_FE(mktime, NULL)
        PHP_FE(gmmktime, NULL)
@@ -793,9 +794,6 @@ PHPAPI int php_idate(char format, time_t ts, int localtime)
                case 'Z': retval = (int) (!localtime ? offset->offset : 0); break;
 
                case 'U': retval = (int) t->sse; break;
-               default:
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
-                       break;
        }
 
        if (!localtime) {
@@ -830,6 +828,7 @@ PHP_FUNCTION(idate)
        char   *format;
        int     format_len;
        time_t  ts;
+       int ret; 
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
                RETURN_FALSE;
@@ -844,7 +843,12 @@ PHP_FUNCTION(idate)
                ts = time(NULL);
        }
 
-       RETURN_LONG(php_idate(format[0], ts, 0));
+       ret = php_idate(format[0], ts, 0);
+       if (ret == -1) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unrecognized date format token.");
+               RETURN_FALSE;
+       }
+       RETURN_LONG(ret);
 }
 /* }}} */
 
index d9d44027b690710aa7c45e140b808cc9f39c7fd5..2fd7c68eb64d6faff46e436af63180927d5b3569 100644 (file)
@@ -28,6 +28,7 @@ extern zend_module_entry date_module_entry;
 #define phpext_date_ptr &date_module_entry
 
 PHP_FUNCTION(date);
+PHP_FUNCTION(idate);
 PHP_FUNCTION(gmdate);
 PHP_FUNCTION(strtotime);