Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Re: Solution to date issue in 5.1 [RSS Feed]

#1 Nov. 26, 2005 10:44:48

Christian S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Solution to date issue in 5.1


Ilia Alshanetsky wrote: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.While there already were objections either voting for removing the classaltogether for now or using a PHP_ prefix I'd like to add another point:If the class is renamed please *also* rename the class timezone whichlives in the same file. Having e.g. PHP_Date/timezone instead ofPHP_Date/PHP_Timezone seems wrong.- Chris

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 26, 2005 12:34:50

P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Solution to date issue in 5.1


On Fri, 25 Nov 2005 23:50:03 -0500
(Ilia Alshanetsky) wrote:

> 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.

I have strong objection, as you know.

Rename it does not deserve the basic idea of a Date class. It does not
have to exist, period.

We can add it in time in php6 and do the required reflection and
communication about it.

--Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 26, 2005 17:17:20

Scott M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Solution to date issue in 5.1


I'd also like to see the fix to ZendEngine2/zend_language_scanner.l
rolled in to this release, its a very annoying regression.

Scott

Ilia Alshanetsky wrote:
> 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

Offline

#4 Nov. 26, 2005 17:20:46

Ilia A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Solution to date issue in 5.1


Scott MacVicar wrote:
> I'd also like to see the fix to ZendEngine2/zend_language_scanner.l
> rolled in to this release, its a very annoying regression.

Yes, that is a problem, and we'll have it fixed in 5.1.1

Ilia

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#5 Nov. 27, 2005 10:16:44

Lukas S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Solution to date issue in 5.1


Ilia Alshanetsky wrote: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.I do not think it makes sense for PHP to start prefixing internalclasses with PHP. We just need a solid userland naming guide so that PHPcan keep the right-of-way for internal naming.As for PEAR if we find better ways of cooperating on the API level itwould be a nice dream, however the reality is that API's are a matter oftaste and traditionally PEAR developer tastes are radically differentfrom internals developers. This is also due to the fact that PEAR API'sare generally designed for completeness, flexibility and extensibility,where as it seems to be that internals traditionally mainly designs forsimplicity. This again leads to the conclusion that PEAR needs to prefixjust like the rest of the PHP world.I have attempted to write such a userland naming guide but I am a bitscared to post it here as I expect this to result in 100 emails wherepeople compete with quantity instead of quality. Anyways if anyone hassincere interest in helping please write me offlist. Obviously thepowers that are need to nod off the final version.regards,
Lukas

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Re: Solution to date issue in 5.1 [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support