The attached patch is a possible solution to the date *crisis*, it
renames the class to PhpDate to avoid any namespace conflicts with pear
or custom user classes called date.
If there are no strong objection 5.1.1 (5.1.0 + this patch and nothing
else) goes out on Monday.
Ilia
Index: ext/date/php_date.c
===================================================================
RCS file: /repository/php-src/ext/date/php_date.c,v
retrieving revision 1.43.2.22
diff -u -p -a -d -r1.43.2.22 php_date.c
--- ext/date/php_date.c 20 Nov 2005 20:14:23 -0000 1.43.2.22
+++ ext/date/php_date.c 26 Nov 2005 04:47:25 -0000
@@ -1006,7 +1006,7 @@ static void date_register_classes(TSRMLS
{
zend_class_entry ce_date, ce_timezone;
- INIT_CLASS_ENTRY(ce_date, "date", date_funcs_date);
+ INIT_CLASS_ENTRY(ce_date, "PhpDate", date_funcs_date);
ce_date.create_object = date_object_new_date;
date_ce_date = zend_register_internal_class_ex(&ce_date, NULL, NULL
TSRMLS_CC);
memcpy(&date_object_handlers_date, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
Index: ext/date/tests/bug33869.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug33869.phpt,v
retrieving revision 1.2.2.1
diff -u -p -a -d -r1.2.2.1 bug33869.phpt
--- ext/date/tests/bug33869.phpt 17 Nov 2005 21:05:30 -0000 1.2.2.1
+++ ext/date/tests/bug33869.phpt 26 Nov 2005 04:47:25 -0000
@@ -4,17 +4,17 @@ Bug #33869 (strtotime() doesn't parse "+
<?php
date_default_timezone_set("UTC");
$tm = strtotime("2005-01-01 01:01:01");
- echo date(date::ISO8601, strtotime('+5days', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+5days', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1month', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+1month', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1year', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+1year', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+5 days', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+5 days', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1 month', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+1 month', $tm));
echo "\n";
- echo date(date::ISO8601, strtotime('+1 year', $tm));
+ echo date(PhpDate::ISO8601, strtotime('+1 year', $tm));
echo "\n";
?>
--EXPECT--
Index: ext/date/tests/bug34087.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug34087.phpt,v
retrieving revision 1.1.2.3
diff -u -p -a -d -r1.1.2.3 bug34087.phpt
--- ext/date/tests/bug34087.phpt 17 Nov 2005 21:05:30 -0000 1.1.2.3
+++ ext/date/tests/bug34087.phpt 26 Nov 2005 04:47:25 -0000
@@ -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(PhpDate::ISO8601, strtotime("2005/1/2")), "\n";
+echo date(PhpDate::ISO8601, strtotime("2005/01/02")), "\n";
+echo date(PhpDate::ISO8601, strtotime("2005/01/2")), "\n";
+echo date(PhpDate::ISO8601, strtotime("2005/1/02")), "\n";
?>
--EXPECT--
Y/m/d: 1123804800
Index: ext/date/tests/bug34676.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug34676.phpt,v
retrieving revision 1.1.2.3
diff -u -p -a -d -r1.1.2.3 bug34676.phpt
--- ext/date/tests/bug34676.phpt 17 Nov 2005 21:05:30 -0000 1.1.2.3
+++ ext/date/tests/bug34676.phpt 26 Nov 2005 04:47:25 -0000
@@ -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(PhpDate::ISO8601, $t));
}
?>
Index: ext/date/tests/bug34771.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/bug34771.phpt,v
retrieving revision 1.1.2.3
diff -u -p -a -d -r1.1.2.3 bug34771.phpt
--- ext/date/tests/bug34771.phpt 17 Nov 2005 21:05:30 -0000 1.1.2.3
+++ ext/date/tests/bug34771.phpt 26 Nov 2005 04:47:25 -0000
@@ -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(PhpDate::ISO8601, $t));
}
?>
Index: ext/date/tests/date_default_timezone_set-1.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/date_default_timezone_set-1.phpt,v
retrieving revision 1.1.2.3
diff -u -p -a -d -r1.1.2.3 date_default_timezone_set-1.phpt
--- ext/date/tests/date_default_timezone_set-1.phpt 17 Nov 2005 21:05:30
-0000 1.1.2.3
+++ ext/date/tests/date_default_timezone_set-1.phpt 26 Nov 2005 04:47:25
-0000
@@ -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(PhpDate::ISO8601, $date1), "\n";
+ echo date(PhpDate::ISO8601, $date2), "\n";
+ echo date(PhpDate::ISO8601, $date3), "\n";
+ echo date(PhpDate::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: ext/date/tests/mktime-3.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/mktime-3.phpt,v
retrieving revision 1.1.2.1
diff -u -p -a -d -r1.1.2.1 mktime-3.phpt
--- ext/date/tests/mktime-3.phpt 17 Nov 2005 21:05:30 -0000 1.1.2.1
+++ ext/date/tests/mktime-3.phpt 26 Nov 2005 04:47:25 -0000
@@ -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 ".PhpDate::ISO8601, $ret), "\n";
}
}
echo "\n";
Index: ext/date/tests/strtotime.phpt
===================================================================
RCS file: /repository/php-src/ext/date/tests/strtotime.phpt,v
retrieving revision 1.1.2.1
diff -u -p -a -d -r1.1.2.1 strtotime.phpt
--- ext/date/tests/strtotime.phpt 17 Nov 2005 21:05:30 -0000 1.1.2.1
+++ ext/date/tests/strtotime.phpt 26 Nov 2005 04:47:25 -0000
@@ -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(PhpDate::ISO8601, $date), "\n";
}
?>
--EXPECT--
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php