Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20487 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25483 invoked by uid 1010); 26 Nov 2005 04:50:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25468 invoked from network); 26 Nov 2005 04:50:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2005 04:50:08 -0000 X-Host-Fingerprint: 70.85.46.36 unknown Received: from ([70.85.46.36:42326] helo=prohost.org) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 73/28-56276-F79E7834 for ; Fri, 25 Nov 2005 23:50:08 -0500 Received: (qmail 20877 invoked from network); 26 Nov 2005 04:50:04 -0000 Received: from prohost.org (HELO ?127.0.0.1?) (70.85.46.36) by prohost.org with SMTP; 26 Nov 2005 04:50:04 -0000 Message-ID: <4387E97B.4040300@prohost.org> Date: Fri, 25 Nov 2005 23:50:03 -0500 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net X-Enigmail-Version: 0.93.0.0 Content-Type: multipart/mixed; boundary="------------000304090909090700040202" Subject: Solution to date issue in 5.1 From: ilia@prohost.org (Ilia Alshanetsky) --------------000304090909090700040202 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------000304090909090700040202 Content-Type: text/plain; name="date[1].txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="date[1].txt" 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 "+ --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-- --------------000304090909090700040202--