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

index 9a9b5d61f459895270115b561e6e644f4cda5f51..fdd7bc2930c2d29a975e0e7b5042ab255b109963 100644 (file)
@@ -899,12 +899,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);