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
{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)
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)
PHP_INI_END()
/* }}} */
+#ifdef EXPERIMENTAL_DATE_SUPPORT
zend_class_entry *date_ce_date, *date_ce_timezone;
static zend_object_handlers date_object_handlers_date;
timelib_tzinfo *tz;
};
-#ifdef EXPERIMENTAL_DATE_SUPPORT
#define DATE_SET_CONTEXT \
zval *object; \
object = getThis(); \
} \
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 = {
{
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;
}
/* }}} */
+#ifdef EXPERIMENTAL_DATE_SUPPORT
static void date_register_classes(TSRMLS_D)
{
zend_class_entry ce_date, ce_timezone;
efree(object);
}
-#ifdef EXPERIMENTAL_DATE_SUPPORT
/* Advanced Interface */
static zval * date_instanciate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
<?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--
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
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));
}
?>
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));
}
?>
$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
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";
$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--