]> granicus.if.org Git - php/commitdiff
Disabled native date class, to prevent pear::date conflict.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 27 Nov 2005 06:51:43 +0000 (06:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 27 Nov 2005 06:51:43 +0000 (06:51 +0000)
NEWS
ext/date/php_date.c
ext/date/tests/bug33869.phpt
ext/date/tests/bug34087.phpt
ext/date/tests/bug34676.phpt
ext/date/tests/bug34771.phpt
ext/date/tests/date_default_timezone_set-1.phpt
ext/date/tests/mktime-3.phpt
ext/date/tests/strtotime.phpt

diff --git a/NEWS b/NEWS
index 21697b1f55be9033a8ef17483c2d749dfaccbe51..c29705210fbace4b87b632b057a664d893b825b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, PHP 5.1.1
+- Disabled native date class, to prevent pear::date conflict. (Ilia)
 - Make reflection constants be both PHP and class constants. (Johannes)
 - Added an additional field $frame['object'] to the result array of
   debug_backtrace() that contains a reference to the respective object when the
index 9c102c76adaf5d2edf70482dce297f5834ac5c3e..149f44ca3054832e2b70950ed38ad258060f6987 100644 (file)
@@ -74,9 +74,8 @@ function_entry date_functions[] = {
        {NULL, NULL, NULL}
 };
 
-
-function_entry date_funcs_date[] = {
 #ifdef EXPERIMENTAL_DATE_SUPPORT
+function_entry date_funcs_date[] = {
        ZEND_NAMED_FE(format, ZEND_FN(date_format), NULL)
        ZEND_NAMED_FE(modify, ZEND_FN(date_modify), NULL)
        ZEND_NAMED_FE(getTimezone, ZEND_FN(date_timezone_get), NULL)
@@ -85,23 +84,21 @@ function_entry date_funcs_date[] = {
        ZEND_NAMED_FE(setTime, ZEND_FN(date_time_set), NULL)
        ZEND_NAMED_FE(setDate, ZEND_FN(date_date_set), NULL)
        ZEND_NAMED_FE(setISODate, ZEND_FN(date_isodate_set), NULL)
-#endif 
        {NULL, NULL, NULL}
 };
 
 function_entry date_funcs_timezone[] = {
-#ifdef EXPERIMENTAL_DATE_SUPPORT
        ZEND_NAMED_FE(getName, ZEND_FN(timezone_name_get), NULL)
        ZEND_NAMED_FE(getOffset, ZEND_FN(timezone_offset_get), NULL)
        ZEND_NAMED_FE(getTransistions, ZEND_FN(timezone_transistions_get), NULL)
        ZEND_MALIAS(timezone, listAbbreviations, abbreviations_list, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
        ZEND_MALIAS(timezone, listIdentifiers, identifiers_list, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-#endif
        {NULL, NULL, NULL}
 };
 
-static char* guess_timezone(TSRMLS_D);
 static void date_register_classes(TSRMLS_D);
+#endif
+static char* guess_timezone(TSRMLS_D);
 /* }}} */
 
 ZEND_DECLARE_MODULE_GLOBALS(date)
@@ -116,6 +113,7 @@ PHP_INI_BEGIN()
 PHP_INI_END()
 /* }}} */
 
+#ifdef EXPERIMENTAL_DATE_SUPPORT
 zend_class_entry *date_ce_date, *date_ce_timezone;
 
 static zend_object_handlers date_object_handlers_date;
@@ -134,7 +132,6 @@ struct _php_timezone_obj {
        timelib_tzinfo *tz;
 };
 
-#ifdef EXPERIMENTAL_DATE_SUPPORT
 #define DATE_SET_CONTEXT \
        zval *object; \
        object = getThis(); \
@@ -153,12 +150,11 @@ struct _php_timezone_obj {
        }       \
        obj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);  \
 
-#endif
-
 static void date_object_free_storage_date(void *object TSRMLS_DC);
 static void date_object_free_storage_timezone(void *object TSRMLS_DC);
 static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC);
 static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC);
+#endif
 
 /* {{{ Module struct */
 zend_module_entry date_module_entry = {
@@ -235,8 +231,19 @@ PHP_MINIT_FUNCTION(date)
 {
        ZEND_INIT_MODULE_GLOBALS(date, php_date_init_globals, NULL);
        REGISTER_INI_ENTRIES();
-
+#ifdef EXPERIMENTAL_DATE_SUPPORT
        date_register_classes(TSRMLS_C);
+#endif
+       REGISTER_STRING_CONSTANT("DATE_ATOM",    DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_COOKIE",  DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RFC822",  DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RFC850",  DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RFC1036", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_RSS",     DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
+       REGISTER_STRING_CONSTANT("DATE_W3C",     DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
 
        php_date_global_timezone_db = NULL;
        php_date_global_timezone_db_enabled = 0;
@@ -1002,6 +1009,7 @@ PHP_FUNCTION(getdate)
 }
 /* }}} */
 
+#ifdef EXPERIMENTAL_DATE_SUPPORT
 static void date_register_classes(TSRMLS_D)
 {
        zend_class_entry ce_date, ce_timezone;
@@ -1107,7 +1115,6 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
        efree(object);
 }
 
-#ifdef EXPERIMENTAL_DATE_SUPPORT
 /* Advanced Interface */
 static zval * date_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
 {
index fc2c4833fa90c4eea591f28830615f6599bd9eec..6957a6b7e24cd02495b29111966c7a4fd2efad16 100644 (file)
@@ -4,17 +4,17 @@ Bug #33869 (strtotime() doesn't parse "+1days" format)
 <?php
        date_default_timezone_set("UTC");
        $tm = strtotime("2005-01-01 01:01:01");
-       echo date(date::ISO8601, strtotime('+5days', $tm));
+       echo date(DATE_ISO8601, strtotime('+5days', $tm));
        echo "\n";
-       echo date(date::ISO8601, strtotime('+1month', $tm));
+       echo date(DATE_ISO8601, strtotime('+1month', $tm));
        echo "\n";
-       echo date(date::ISO8601, strtotime('+1year', $tm));
+       echo date(DATE_ISO8601, strtotime('+1year', $tm));
        echo "\n";
-       echo date(date::ISO8601, strtotime('+5 days', $tm));
+       echo date(DATE_ISO8601, strtotime('+5 days', $tm));
        echo "\n";
-       echo date(date::ISO8601, strtotime('+1 month', $tm));
+       echo date(DATE_ISO8601, strtotime('+1 month', $tm));
        echo "\n";
-       echo date(date::ISO8601, strtotime('+1 year', $tm));
+       echo date(DATE_ISO8601, strtotime('+1 year', $tm));
        echo "\n";
 ?>
 --EXPECT--
index 76640c3954d26ba2ec2db68b6b6220310724f3a0..3fa3885481731191e2dabffe7cb1ec62d17afe0a 100644 (file)
@@ -6,10 +6,10 @@ date_default_timezone_set("UTC");
 echo "Y/m/d: ", strtotime("2005/8/12"), "\n";
 echo "Y-m-d: ", strtotime("2005-8-12"), "\n";
 
-echo date(date::ISO8601, strtotime("2005/1/2")), "\n";
-echo date(date::ISO8601, strtotime("2005/01/02")), "\n";
-echo date(date::ISO8601, strtotime("2005/01/2")), "\n";
-echo date(date::ISO8601, strtotime("2005/1/02")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/1/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/02")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/01/2")), "\n";
+echo date(DATE_ISO8601, strtotime("2005/1/02")), "\n";
 ?>
 --EXPECT--
 Y/m/d: 1123804800
index 84f58e922a8e405b588e0a3465aaa5117ac198fe..6f616feb4064a8f7cad423fc9ebeb00c77ed51b5 100644 (file)
@@ -10,7 +10,7 @@ $tests = array(
 
 foreach ($tests as $test) {
        $t = strtotime("2005-12-22 ". $test);
-       printf("%-10s => %s\n", $test, date(date::ISO8601, $t));
+       printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
 }
 
 ?>
index bed9511d60d4dc77d9d12fa682770543fafefd42..a27d085a1da7bb65db906dc7794a106ff2f00d20 100644 (file)
@@ -13,7 +13,7 @@ $tests = array(
 
 foreach ($tests as $test) {
        $t = strtotime("2005-12-22 ". $test);
-       printf("%-10s => %s\n", $test, date(date::ISO8601, $t));
+       printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
 }
 
 ?>
index 3b422a869079692276890a8c254cf2043a0c4657..90916e9238edf244054ba8f7f37eb2d0265a1ed2 100644 (file)
@@ -12,10 +12,10 @@ date.timezone=
        $date4 = strtotime("2005-07-12 08:00:00");
 
        echo date_default_timezone_get(), "\n";
-       echo date(date::ISO8601, $date1), "\n";
-       echo date(date::ISO8601, $date2), "\n";
-       echo date(date::ISO8601, $date3), "\n";
-       echo date(date::ISO8601, $date4), "\n";
+       echo date(DATE_ISO8601, $date1), "\n";
+       echo date(DATE_ISO8601, $date2), "\n";
+       echo date(DATE_ISO8601, $date3), "\n";
+       echo date(DATE_ISO8601, $date4), "\n";
 ?>
 --EXPECTF--
 Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'Europe/London' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3
index 7e9aa62d93968f5f4b65d7ef753413c95d1c4e48..d4ccfbabe4737009bedf56a4d0db89f2c9bd961e 100644 (file)
@@ -16,7 +16,7 @@ foreach ($tzs as $tz) {
                if ($ret == FALSE) {
                        echo "out of range\n";
                } else {
-                       echo date("F ".date::ISO8601, $ret), "\n";
+                       echo date("F ".DATE_ISO8601, $ret), "\n";
                }
        }
        echo "\n";
index e8eea399d2a2b7dcb3d55cc5a4af7556b4a0b17e..6560d7f1fd3e94e1aa44ba3776e2635e0e3a707d 100644 (file)
@@ -8,7 +8,7 @@ $d[] = strtotime("2005-07-14 22:30:41");
 $d[] = strtotime("2005-07-14 22:30:41 GMT");
 
 foreach($d as $date) {
-       echo date(date::ISO8601, $date), "\n";
+       echo date(DATE_ISO8601, $date), "\n";
 }
 ?>
 --EXPECT--