stas Mon, 24 Jan 2011 01:15:41 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=307688
Log: Fixed Bug #52063 (DateTime constructor's second argument doesn't have a null default value) Bug: http://bugs.php.net/52063 (Assigned) DateTime constructor's second argument doesn't have a null default value Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/date/php_date.c A php/php-src/branches/PHP_5_3/ext/date/tests/bug52063.phpt U php/php-src/trunk/ext/date/php_date.c A php/php-src/trunk/ext/date/tests/bug52063.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-01-23 22:40:35 UTC (rev 307687) +++ php/php-src/branches/PHP_5_3/NEWS 2011-01-24 01:15:41 UTC (rev 307688) @@ -36,6 +36,8 @@ no effect. (Derick) . Fixed bug #53729 (DatePeriod fails to initialize recurrences on 64bit big-endian systems). (Derick, r...@basefarm.no) + . Fixed bug #52063 (DateTime constructor's second argument doesn't have a + null default value). (Gustavo, Stas) - Filter extension: . Fixed bug #53150 (FILTER_FLAG_NO_RES_RANGE is missing some IP ranges). Modified: php/php-src/branches/PHP_5_3/ext/date/php_date.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/php_date.c 2011-01-23 22:40:35 UTC (rev 307687) +++ php/php-src/branches/PHP_5_3/ext/date/php_date.c 2011-01-24 01:15:41 UTC (rev 307688) @@ -2465,7 +2465,7 @@ char *time_str = NULL; int time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2507,7 +2507,7 @@ zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug52063.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/date/tests/bug52063.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52063.phpt 2011-01-24 01:15:41 UTC (rev 307688) @@ -0,0 +1,15 @@ +--TEST-- +Bug #52063 (DateTime constructor's second argument doesn't have a null default value) +--FILE-- +<?php +date_default_timezone_set("Europe/Lisbon"); +$a = new DateTime("2009-01-01", null); +echo $a->format(DateTime::COOKIE); +echo "\n"; +$a = date_create("2009-01-01", null); +echo $a->format(DateTime::COOKIE); +echo "\n"; +?> +--EXPECTF-- +Thursday, 01-Jan-09 00:00:00 WET +Thursday, 01-Jan-09 00:00:00 WET Modified: php/php-src/trunk/ext/date/php_date.c =================================================================== --- php/php-src/trunk/ext/date/php_date.c 2011-01-23 22:40:35 UTC (rev 307687) +++ php/php-src/trunk/ext/date/php_date.c 2011-01-24 01:15:41 UTC (rev 307688) @@ -2460,7 +2460,7 @@ char *time_str = NULL; int time_str_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -2502,7 +2502,7 @@ zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); Added: php/php-src/trunk/ext/date/tests/bug52063.phpt =================================================================== --- php/php-src/trunk/ext/date/tests/bug52063.phpt (rev 0) +++ php/php-src/trunk/ext/date/tests/bug52063.phpt 2011-01-24 01:15:41 UTC (rev 307688) @@ -0,0 +1,15 @@ +--TEST-- +Bug #52063 (DateTime constructor's second argument doesn't have a null default value) +--FILE-- +<?php +date_default_timezone_set("Europe/Lisbon"); +$a = new DateTime("2009-01-01", null); +echo $a->format(DateTime::COOKIE); +echo "\n"; +$a = date_create("2009-01-01", null); +echo $a->format(DateTime::COOKIE); +echo "\n"; +?> +--EXPECTF-- +Thursday, 01-Jan-09 00:00:00 WET +Thursday, 01-Jan-09 00:00:00 WET
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php