]> granicus.if.org Git - php/commitdiff
MFB: Initialize ts only after successful argument parsing
authorIlia Alshanetsky <iliaa@php.net>
Sun, 9 Mar 2008 18:10:09 +0000 (18:10 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 9 Mar 2008 18:10:09 +0000 (18:10 +0000)
ext/date/php_date.c

index 1c0e1e40e6d215cd935cff154ef22a69f6e3e910..765ab59e27ef4ac9404eac568909d80eb053aee0 100644 (file)
@@ -1013,12 +1013,12 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
        long    ts;
        char   *string;
 
-       if (ZEND_NUM_ARGS() == 1) {
-               ts = time(NULL);
-       }
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
                RETURN_FALSE;
        }
+       if (ZEND_NUM_ARGS() == 1) {
+               ts = time(NULL);
+       }
 
        string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);