[PHP-CVS] svn: /SVNROOT/ commit-email.php
gwynne Sat, 12 Jan 2013 17:05:31 + Revision: http://svn.php.net/viewvc?view=revision&revision=329106 Log: Gwynne doesn't need to get every commit email anymore. Changed paths: U SVNROOT/commit-email.php Modified: SVNROOT/commit-email.php === --- SVNROOT/commit-email.php2013-01-12 14:29:26 UTC (rev 329105) +++ SVNROOT/commit-email.php2013-01-12 17:05:31 UTC (rev 329106) @@ -109,7 +109,7 @@ '|^SVNROOT|' => array('php-cvs@lists.php.net'), ); $fallback_addresses = array('php-cvs@lists.php.net'); -$always_addresses = array('gwy...@php.net', 'ping+twvhw...@cia.vc'); +$always_addresses = array('ping+twvhw...@cia.vc'); // - // Build list of e-mail addresses and parent changed path -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Implemented immutable DateTime objects as the DateTimePoint class.: ext/date/php_date.c ext/date/php_date.h
Commit:9657591e35b0466b8d86284a78f8cba8bbd4e4b9 Author:Derick Rethans Mon, 17 Dec 2012 15:31:23 + Parents: 52dd0d1c73e6b67eaad256cb1349e314408d2bc8 Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9657591e35b0466b8d86284a78f8cba8bbd4e4b9 Log: Implemented immutable DateTime objects as the DateTimePoint class. Changed paths: M ext/date/php_date.c M ext/date/php_date.h diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 0394cb6..61f6a95 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -385,7 +385,9 @@ const zend_function_entry date_functions[] = { /* Advanced Interface */ PHP_FE(date_create, arginfo_date_create) + PHP_FE(date_create_point, arginfo_date_create) PHP_FE(date_create_from_format, arginfo_date_create_from_format) + PHP_FE(date_create_point_from_format, arginfo_date_create_from_format) PHP_FE(date_parse, arginfo_date_parse) PHP_FE(date_parse_from_format, arginfo_date_parse_from_format) PHP_FE(date_get_last_errors, arginfo_date_get_last_errors) @@ -450,6 +452,20 @@ const zend_function_entry date_funcs_date[] = { PHP_FE_END }; +const zend_function_entry date_funcs_point[] = { + PHP_ME(DateTimePoint, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimePoint, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTimePoint, modify,arginfo_date_method_modify, 0) + PHP_ME(DateTimePoint, add, arginfo_date_method_add, 0) + PHP_ME(DateTimePoint, sub, arginfo_date_method_sub, 0) + PHP_ME(DateTimePoint, setTimezone, arginfo_date_method_timezone_set, 0) + PHP_ME(DateTimePoint, setTime, arginfo_date_method_time_set, 0) + PHP_ME(DateTimePoint, setDate, arginfo_date_method_date_set, 0) + PHP_ME(DateTimePoint, setISODate,arginfo_date_method_isodate_set, 0) + PHP_ME(DateTimePoint, setTimestamp, arginfo_date_method_timestamp_set, 0) + PHP_FE_END +}; + const zend_function_entry date_funcs_timezone[] = { PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0) @@ -508,6 +524,7 @@ PHP_INI_END() /* }}} */ zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; +zend_class_entry *date_ce_point; PHPAPI zend_class_entry *php_date_get_date_ce(void) @@ -515,12 +532,18 @@ PHPAPI zend_class_entry *php_date_get_date_ce(void) return date_ce_date; } +PHPAPI zend_class_entry *php_date_get_point_ce(void) +{ + return date_ce_point; +} + PHPAPI zend_class_entry *php_date_get_timezone_ce(void) { return date_ce_timezone; } static zend_object_handlers date_object_handlers_date; +static zend_object_handlers date_object_handlers_point; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; @@ -555,11 +578,13 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC); static void date_object_free_storage_period(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_point(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC); +static zend_object_value date_object_clone_point(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC); static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC); @@ -1908,7 +1933,7 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval static void date_register_classes(TSRMLS_D) { - zend_class_entry ce_date, ce_timezone, ce_interval, ce_period; + zend_class_entry ce_date, ce_point, ce_timezone, ce_interval, ce_period; INIT_CLASS_ENTRY(ce_date, "DateTime", date_funcs_date); ce_date.create_object = date_object_new_date; @@ -1934,6 +1959,13 @@ static void date_register_classes(TSRMLS_D) REGISTER_DATE_CLASS_CONST_STRING("RSS", DATE_FORMAT_RFC1123); REGISTER_DATE_CLASS_CONST_STRING("W3C", DATE_FORMAT_RFC3339); + INIT_CLASS_ENTRY(ce_point, "DateTimePoint", date_funcs_point); + ce_point.create_object = date_object_new_date; + dat
[PHP-CVS] com php-src: Added a test case for DateTimePoint.: ext/date/tests/date_time_point.phpt
Commit:21d7efef922956a233cc2bfdfba139a88fdc6c4f Author:Derick Rethans Mon, 17 Dec 2012 16:35:52 + Parents: 9657591e35b0466b8d86284a78f8cba8bbd4e4b9 Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=21d7efef922956a233cc2bfdfba139a88fdc6c4f Log: Added a test case for DateTimePoint. Changed paths: A ext/date/tests/date_time_point.phpt Diff: diff --git a/ext/date/tests/date_time_point.phpt b/ext/date/tests/date_time_point.phpt new file mode 100644 index 000..810eeca --- /dev/null +++ b/ext/date/tests/date_time_point.phpt @@ -0,0 +1,167 @@ +--TEST-- +Tests for DateTimePoint. +--INI-- +date.timezone=Europe/London +--FILE-- +format('Y-m-d H:i:s e'), "\n"; + echo 'copy:', $b->format('Y-m-d H:i:s e'), "\n"; + echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n"; +} + +echo "modify():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->modify("+2 days"); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->modify("+2 days"); +dump($v, $z, $x); + +echo "\nadd():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->add(new DateInterval("P2DT2S")); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->add(new DateInterval("P2DT2S")); +dump($v, $z, $x); + +echo "\nsub():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->sub(new DateInterval("P2DT2S")); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->sub(new DateInterval("P2DT2S")); +dump($v, $z, $x); + +echo "\nsetTimezone():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->setTimezone($tz); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->setTimezone($tz); +dump($v, $z, $x); +$v = new DateTimePoint($current); +$z = $v; +$x = $z->setTimezone($tz); +dump($v, $z, $x); + +echo "\nsetTime():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->setTime(5, 7, 19); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->setTime(5, 7, 19); +dump($v, $z, $x); + +echo "\nsetDate():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->setDate(5, 7, 19); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->setDate(5, 7, 19); +dump($v, $z, $x); + +echo "\nsetIsoDate():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->setIsoDate(2012, 2, 6); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->setIsoDate(2012, 2, 6); +dump($v, $z, $x); + +echo "\nsetTimestamp():\n"; +$v = date_create_point($current); +$z = $v; +$x = $z->setTimestamp(2012234222); +dump($v, $z, $x); +$v = date_create($current); +$z = $v; +$x = $z->setTimestamp(2012234222); +dump($v, $z, $x); +?> +--EXPECT-- +modify(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-29 16:24:08 Europe/London +orig:2012-12-29 16:24:08 Europe/London +copy:2012-12-29 16:24:08 Europe/London +changed: 2012-12-29 16:24:08 Europe/London + +add(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-29 16:24:10 Europe/London +orig:2012-12-29 16:24:10 Europe/London +copy:2012-12-29 16:24:10 Europe/London +changed: 2012-12-29 16:24:10 Europe/London + +sub(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-25 16:24:06 Europe/London +orig:2012-12-25 16:24:06 Europe/London +copy:2012-12-25 16:24:06 Europe/London +changed: 2012-12-25 16:24:06 Europe/London + +setTimezone(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-28 01:24:08 Asia/Tokyo +orig:2012-12-28 01:24:08 Asia/Tokyo +copy:2012-12-28 01:24:08 Asia/Tokyo +changed: 2012-12-28 01:24:08 Asia/Tokyo +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-28 01:24:08 Asia/Tokyo + +setTime(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-12-27 05:07:19 Europe/London +orig:2012-12-27 05:07:19 Europe/London +copy:2012-12-27 05:07:19 Europe/London +changed: 2012-12-27 05:07:19 Europe/London + +setDate(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 0005-07-19 16:24:08 Europe/London +orig:0005-07-19 16:24:08 Europe/London +copy:0005-07-19 16:24:08 Europe/London +changed: 0005-07-19 16:24:08 Europe/London + +setIsoDate(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2012-01-14 16:24:08 Europe/London +orig:2012-01-14 16:24:08 Europe/London +copy:2012-01-14 16:24:08 Europe/London +changed: 2012-01-14 16:24:08 Europe/London + +setTimestamp(): +orig:2012-12-27 16:24:08 Europe/London +copy:2012-12-27 16:24:08 Europe/London +changed: 2033-10-06 18:57:02 Europe/London +orig:2033-10-06 18:57:02 Europe/London +copy:2033-10-06 18:57:02 Europe/London +changed:
[PHP-CVS] com php-src: Added a few missing TSRMLS_DC/TSRMLS_CC.: ext/date/php_date.c
Commit:99e7d1dca2f7e6cd05a955a42c38792a694cc836 Author:Derick Rethans Mon, 17 Dec 2012 16:49:00 + Parents: 21d7efef922956a233cc2bfdfba139a88fdc6c4f Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=99e7d1dca2f7e6cd05a955a42c38792a694cc836 Log: Added a few missing TSRMLS_DC/TSRMLS_CC. Changed paths: M ext/date/php_date.c Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 61f6a95..3fbdaf2 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2883,7 +2883,7 @@ PHP_FUNCTION(date_format) } /* }}} */ -static void php_date_modify(zval *object, char *modify, int modify_len, zval *return_value) +static void php_date_modify(zval *object, char *modify, int modify_len, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; timelib_time *tmp_time; @@ -2952,7 +2952,7 @@ PHP_FUNCTION(date_modify) RETURN_FALSE; } - php_date_modify(object, modify, modify_len, return_value); + php_date_modify(object, modify, modify_len, return_value TSRMLS_CC); RETURN_ZVAL(getThis(), 1, 0); } @@ -2971,13 +2971,13 @@ PHP_METHOD(DateTimePoint, modify) } new_object = date_clone_point(object); - php_date_modify(new_object, modify, modify_len, return_value); + php_date_modify(new_object, modify, modify_len, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } /* }}} */ -static void php_date_add(zval *object, zval *interval, zval *return_value) +static void php_date_add(zval *object, zval *interval, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; php_interval_obj *intobj; @@ -3021,7 +3021,7 @@ PHP_FUNCTION(date_add) RETURN_FALSE; } - php_date_add(object, interval, return_value); + php_date_add(object, interval, return_value TSRMLS_CC); RETURN_ZVAL(object, 1, 0); } @@ -3038,13 +3038,13 @@ PHP_METHOD(DateTimePoint, add) } new_object = date_clone_point(object); - php_date_add(new_object, interval, return_value); + php_date_add(new_object, interval, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } /* }}} */ -static void php_date_sub(zval *object, zval *interval, zval *return_value) +static void php_date_sub(zval *object, zval *interval, zval *return_value TSRMLS_DC) { php_date_obj *dateobj; php_interval_obj *intobj; @@ -3091,7 +3091,7 @@ PHP_FUNCTION(date_sub) RETURN_FALSE; } - php_date_sub(object, interval, return_value); + php_date_sub(object, interval, return_value TSRMLS_CC); RETURN_ZVAL(object, 1, 0); } @@ -3108,7 +3108,7 @@ PHP_METHOD(DateTimePoint, sub) } new_object = date_clone_point(object); - php_date_sub(new_object, interval, return_value); + php_date_sub(new_object, interval, return_value TSRMLS_CC); RETURN_ZVAL(new_object, 0, 1); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Added another test to test the unmodified inherited methods.: ext/date/tests/date_time_point-inherited.phpt
Commit:0f679b926cb39f642ca051cb3ae6d7ab55db21fc Author:Derick Rethans Mon, 17 Dec 2012 16:49:25 + Parents: 99e7d1dca2f7e6cd05a955a42c38792a694cc836 Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0f679b926cb39f642ca051cb3ae6d7ab55db21fc Log: Added another test to test the unmodified inherited methods. Changed paths: A ext/date/tests/date_time_point-inherited.phpt Diff: diff --git a/ext/date/tests/date_time_point-inherited.phpt b/ext/date/tests/date_time_point-inherited.phpt new file mode 100644 index 000..e355407 --- /dev/null +++ b/ext/date/tests/date_time_point-inherited.phpt @@ -0,0 +1,25 @@ +--TEST-- +Tests for DateTimePoint. +--INI-- +date.timezone=Europe/London +--FILE-- +getTimezone(); +var_dump($x->getName()); + +echo "\ngetTimestamp():\n"; +$v = date_create_point($current); +$x = $v->getTimestamp(); +var_dump($x); +?> +--EXPECT-- +getTimezone(): +string(13) "Europe/London" + +getTimestamp(): +int(1356625448) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Rename DateTimePoint to DateTimeImmutable.: ext/date/php_date.c ext/date/php_date.h ext/date/tests/date_time_immutable-inherited.phpt ext/date/tests/date_time_immutable.phpt ext
Commit:8b9d23c0cfcdfaa39f0a7d097cc471143cd4f4d2 Author:Derick Rethans Wed, 19 Dec 2012 16:24:38 + Parents: 0f679b926cb39f642ca051cb3ae6d7ab55db21fc Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8b9d23c0cfcdfaa39f0a7d097cc471143cd4f4d2 Log: Rename DateTimePoint to DateTimeImmutable. Changed paths: M ext/date/php_date.c M ext/date/php_date.h A ext/date/tests/date_time_immutable-inherited.phpt A ext/date/tests/date_time_immutable.phpt D ext/date/tests/date_time_point-inherited.phpt D ext/date/tests/date_time_point.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 3fbdaf2..596a7a9 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -385,9 +385,9 @@ const zend_function_entry date_functions[] = { /* Advanced Interface */ PHP_FE(date_create, arginfo_date_create) - PHP_FE(date_create_point, arginfo_date_create) + PHP_FE(date_create_immutable, arginfo_date_create) PHP_FE(date_create_from_format, arginfo_date_create_from_format) - PHP_FE(date_create_point_from_format, arginfo_date_create_from_format) + PHP_FE(date_create_immutable_from_format, arginfo_date_create_from_format) PHP_FE(date_parse, arginfo_date_parse) PHP_FE(date_parse_from_format, arginfo_date_parse_from_format) PHP_FE(date_get_last_errors, arginfo_date_get_last_errors) @@ -452,17 +452,17 @@ const zend_function_entry date_funcs_date[] = { PHP_FE_END }; -const zend_function_entry date_funcs_point[] = { - PHP_ME(DateTimePoint, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) - PHP_ME(DateTimePoint, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(DateTimePoint, modify,arginfo_date_method_modify, 0) - PHP_ME(DateTimePoint, add, arginfo_date_method_add, 0) - PHP_ME(DateTimePoint, sub, arginfo_date_method_sub, 0) - PHP_ME(DateTimePoint, setTimezone, arginfo_date_method_timezone_set, 0) - PHP_ME(DateTimePoint, setTime, arginfo_date_method_time_set, 0) - PHP_ME(DateTimePoint, setDate, arginfo_date_method_date_set, 0) - PHP_ME(DateTimePoint, setISODate,arginfo_date_method_isodate_set, 0) - PHP_ME(DateTimePoint, setTimestamp, arginfo_date_method_timestamp_set, 0) +const zend_function_entry date_funcs_immutable[] = { + PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimeImmutable, __set_state, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + PHP_ME(DateTimeImmutable, modify,arginfo_date_method_modify, 0) + PHP_ME(DateTimeImmutable, add, arginfo_date_method_add, 0) + PHP_ME(DateTimeImmutable, sub, arginfo_date_method_sub, 0) + PHP_ME(DateTimeImmutable, setTimezone, arginfo_date_method_timezone_set, 0) + PHP_ME(DateTimeImmutable, setTime, arginfo_date_method_time_set, 0) + PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0) + PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0) + PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0) PHP_FE_END }; @@ -524,7 +524,7 @@ PHP_INI_END() /* }}} */ zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period; -zend_class_entry *date_ce_point; +zend_class_entry *date_ce_immutable; PHPAPI zend_class_entry *php_date_get_date_ce(void) @@ -532,9 +532,9 @@ PHPAPI zend_class_entry *php_date_get_date_ce(void) return date_ce_date; } -PHPAPI zend_class_entry *php_date_get_point_ce(void) +PHPAPI zend_class_entry *php_date_get_immutable_ce(void) { - return date_ce_point; + return date_ce_immutable; } PHPAPI zend_class_entry *php_date_get_timezone_ce(void) @@ -543,7 +543,7 @@ PHPAPI zend_class_entry *php_date_get_timezone_ce(void) } static zend_object_handlers date_object_handlers_date; -static zend_object_handlers date_object_handlers_point; +static zend_object_handlers date_object_handlers_immutable; static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; @@ -578,13 +578,13 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC); static void date_object_free_storage_period(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_point(zend_class_entry *class_type TSRMLS_DC); +static zend_object_value date_object_new_immutable(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC); static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC); static zen
[PHP-CVS] com php-src: Fixed crash bug when the non-OO interface was used.: ext/date/php_date.c
Commit:793b52b576e7af8823ae24622c6a331fd473e149 Author:Derick Rethans Wed, 19 Dec 2012 17:40:14 + Parents: 8b9d23c0cfcdfaa39f0a7d097cc471143cd4f4d2 Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=793b52b576e7af8823ae24622c6a331fd473e149 Log: Fixed crash bug when the non-OO interface was used. Changed paths: M ext/date/php_date.c Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 596a7a9..fc281ce 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2954,7 +2954,7 @@ PHP_FUNCTION(date_modify) php_date_modify(object, modify, modify_len, return_value TSRMLS_CC); - RETURN_ZVAL(getThis(), 1, 0); + RETURN_ZVAL(object, 1, 0); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Make DatePeriod support DateTimeImmutable as well.: ext/date/php_date.c ext/date/php_date.h ext/date/tests/date_period-immutable.phpt
Commit:62129f31a758e86f62410262bb6096f1b2584363 Author:Derick Rethans Thu, 20 Dec 2012 13:22:18 + Parents: 793b52b576e7af8823ae24622c6a331fd473e149 Branches: immutable-date Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=62129f31a758e86f62410262bb6096f1b2584363 Log: Make DatePeriod support DateTimeImmutable as well. If the start element is a DateTimeImmutable object, then all returned objects are also DateTimeImmutable objects. If the start element is a DateTime object, then all returned objects are DateTime objects. Changed paths: M ext/date/php_date.c M ext/date/php_date.h A ext/date/tests/date_period-immutable.phpt Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index fc281ce..cc83130 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1847,7 +1847,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data /* Create new object */ MAKE_STD_ZVAL(iterator->current); - php_date_instantiate(date_ce_date, iterator->current TSRMLS_CC); + php_date_instantiate(object->start_ce, iterator->current TSRMLS_CC); newdateobj = (php_date_obj *) zend_object_store_get_object(iterator->current TSRMLS_CC); newdateobj->time = timelib_time_ctor(); *newdateobj->time = *it_time; @@ -4182,6 +4182,7 @@ PHP_METHOD(DatePeriod, __construct) if (dpobj->end) { timelib_update_ts(dpobj->end, NULL); } + dpobj->start_ce = date_ce_date; } else { /* init */ intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); @@ -4197,6 +4198,7 @@ PHP_METHOD(DatePeriod, __construct) clone->tz_info = dateobj->time->tz_info; } dpobj->start = clone; + dpobj->start_ce = Z_OBJCE_P(start); /* interval */ dpobj->interval = timelib_rel_time_clone(intobj->diff); diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 19c692b..3af3fa4 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -154,6 +154,7 @@ struct _php_interval_obj { struct _php_period_obj { zend_object std; timelib_time *start; + zend_class_entry *start_ce; timelib_time *current; timelib_time *end; timelib_rel_time *interval; diff --git a/ext/date/tests/date_period-immutable.phpt b/ext/date/tests/date_period-immutable.phpt new file mode 100644 index 000..0ec4b4a --- /dev/null +++ b/ext/date/tests/date_period-immutable.phpt @@ -0,0 +1,56 @@ +--TEST-- +DatePeriod +--FILE-- +format( "l Y-m-d\n" ); +echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); + echo $dt->format( "l Y-m-d\n\n" ); +} + +foreach ( new DatePeriod( $db2, $di, $de ) as $dt ) +{ + echo get_class( $dt ), "\n"; + echo $dt->format( "l Y-m-d\n" ); +echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); + echo $dt->format( "l Y-m-d\n\n" ); +} +?> +--EXPECT-- +DateTimeImmutable +Tuesday 2008-01-01 +Tuesday 2008-01-15 +Tuesday 2008-01-01 + +DateTimeImmutable +Friday 2008-02-01 +Tuesday 2008-02-19 +Friday 2008-02-01 + +DateTimeImmutable +Saturday 2008-03-01 +Tuesday 2008-03-18 +Saturday 2008-03-01 + +DateTime +Tuesday 2008-01-01 +Tuesday 2008-01-15 +Tuesday 2008-01-15 + +DateTime +Friday 2008-02-01 +Tuesday 2008-02-19 +Tuesday 2008-02-19 + +DateTime +Saturday 2008-03-01 +Tuesday 2008-03-18 +Tuesday 2008-03-18 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] del php-src: NEWS TSRM/tsrm_nw.c TSRM/tsrm_nw.h TSRM/tsrm_virtual_cwd.c TSRM/tsrm_virtual_cwd.h TSRM/tsrm_win32.c TSRM/tsrm_win32.h Zend/tests/bug63882.phpt Zend/tests/generators/clone_after
Branch: immutable-date Deleted commits count: 7 User: Derick Rethans Sat, 12 Jan 2013 16:42:57 + M NEWS M TSRM/tsrm_nw.c M TSRM/tsrm_nw.h M TSRM/tsrm_virtual_cwd.c M TSRM/tsrm_virtual_cwd.h M TSRM/tsrm_win32.c M TSRM/tsrm_win32.h A Zend/tests/bug63882.phpt A Zend/tests/generators/clone_after_object_call.phpt A Zend/tests/generators/throw_already_closed.phpt A Zend/tests/generators/throw_caught.phpt A Zend/tests/generators/throw_not_an_exception.phpt A Zend/tests/generators/throw_rethrow.phpt A Zend/tests/generators/throw_uncaught.phpt A Zend/tests/generators/yield_closure.phpt M Zend/tests/traits/bug60153.phpt M Zend/tests/traits/bug60217b.phpt M Zend/tests/traits/bug60217c.phpt M Zend/tests/traits/bugs/abstract-methods05.phpt M Zend/tests/traits/bugs/abstract-methods06.phpt M Zend/tests/traits/error_010.phpt M Zend/tests/traits/inheritance003.phpt A Zend/tests/traits/language014.phpt A Zend/tests/traits/language015.phpt A Zend/tests/traits/language016.phpt A Zend/tests/traits/language017.phpt A Zend/tests/traits/language018.phpt A Zend/tests/traits/language019.phpt M Zend/zend.c M Zend/zend.h M Zend/zend_API.c M Zend/zend_API.h M Zend/zend_alloc.c M Zend/zend_alloc.h M Zend/zend_build.h M Zend/zend_builtin_functions.c M Zend/zend_builtin_functions.h M Zend/zend_closures.c M Zend/zend_closures.h M Zend/zend_compile.c M Zend/zend_compile.h M Zend/zend_config.nw.h M Zend/zend_config.w32.h M Zend/zend_constants.c M Zend/zend_constants.h M Zend/zend_default_classes.c M Zend/zend_dynamic_array.c M Zend/zend_dynamic_array.h M Zend/zend_errors.h M Zend/zend_exceptions.c M Zend/zend_exceptions.h M Zend/zend_execute.c M Zend/zend_execute.h M Zend/zend_execute_API.c M Zend/zend_extensions.c M Zend/zend_extensions.h M Zend/zend_float.c M Zend/zend_float.h M Zend/zend_gc.c M Zend/zend_gc.h M Zend/zend_generators.c M Zend/zend_generators.h M Zend/zend_globals.h M Zend/zend_globals_macros.h M Zend/zend_hash.c M Zend/zend_hash.h M Zend/zend_highlight.c M Zend/zend_highlight.h M Zend/zend_indent.c M Zend/zend_indent.h M Zend/zend_ini.c M Zend/zend_ini.h M Zend/zend_ini_parser.y M Zend/zend_ini_scanner.c M Zend/zend_ini_scanner.h M Zend/zend_ini_scanner.l M Zend/zend_interfaces.c M Zend/zend_interfaces.h M Zend/zend_istdiostream.h M Zend/zend_iterators.c M Zend/zend_iterators.h M Zend/zend_language_parser.y M Zend/zend_language_scanner.c M Zend/zend_language_scanner.h M Zend/zend_language_scanner.l M Zend/zend_list.c M Zend/zend_list.h M Zend/zend_llist.c M Zend/zend_llist.h M Zend/zend_modules.h M Zend/zend_multibyte.c M Zend/zend_multibyte.h M Zend/zend_multiply.h M Zend/zend_object_handlers.c M Zend/zend_object_handlers.h M Zend/zend_objects.c M Zend/zend_objects.h M Zend/zend_objects_API.c M Zend/zend_objects_API.h M Zend/zend_opcode.c M Zend/zend_operators.c M Zend/zend_operators.h M Zend/zend_ptr_stack.c M Zend/zend_ptr_stack.h M Zend/zend_qsort.c M Zend/zend_qsort.h M Zend/zend_sprintf.c M Zend/zend_stack.c M Zend/zend_stack.h M Zend/zend_static_allocator.c M Zend/zend_static_allocator.h M Zend/zend_stream.c M Zend/zend_stream.h M Zend/zend_string.c M Zend/zend_string.h M Zend/zend_strtod.h M Zend/zend_ts_hash.c M Zend/zend_ts_hash.h M Zend/zend_types.h M Zend/zend_variables.c M Zend/zend_variables.h M Zend/zend_vm.h M Zend/zend_vm_def.h M Zend/zend_vm_execute.h M Zend/zend_vm_gen.php M Zend/zend_vm_opcodes.h M ext/bcmath/bcmath.c M ext/bcmath/php_bcmath.h M ext/bz2/bz2.c M ext/bz2/bz2_filter.c M ext/bz2/php_bz2.h M ext/calendar/cal_unix.c M ext/calendar/calendar.c M ext/calendar/easter.c M ext/com_dotnet/com_com.c M ext/com_dotnet/com_dotnet.c M ext/com_dotnet/com_extension.c M ext/com_dotnet/com_handlers.c M ext/com_dotnet/com_iterator.c M ext/com_dotnet/com_misc.c M ext/com_dotnet/com_olechar.c M ext/com_dotnet/com_persist.c M ext/com_dotnet/com_saproxy.c M ext/com_dotnet/com_typeinfo.c M ext/com_dotnet/com_variant.c M ext/com_dotnet/com_wrapper.c M ext/com_dotnet/php_com_dotnet.h M ext/com_dotnet/php_com_dotnet_internal.h M ext/ctype/ctype.c M ext/ctype/php_ctype.h M ext/curl/interface.c M ext/curl/multi.c M ext/curl/php_curl.h M ext/curl/share.c M ext/curl/streams.c M ext/curl/tests/bug63363.phpt A ext/curl/tests/bug63795.phpt A ext/curl/tests/curl_multi_segfault.phpt A ext/curl/tests/curl_multi_setopt_basic001.phpt A ext/curl/tests/curl_multi_strerror_001.phpt A ext/curl/tests/curl_share_setopt_basic001.phpt A ext/curl/tests/curl_strerror_001.phpt M ext/date/lib/astro.c M ext/date/lib/dow.c M ext/date/lib/interv