diff options
author | Stanislav Malyshev <stas@php.net> | 2011-01-24 01:15:41 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2011-01-24 01:15:41 +0000 |
commit | a6c0a4e4746084df2828ea5875cf52ad9ae674f0 (patch) | |
tree | f4e270166d94478d7f5af79c1a697da1a73d7bd5 /ext | |
parent | bc049ccb620c4fcce36d5d25f8588ba5d8ad3ef0 (diff) | |
download | php-git-a6c0a4e4746084df2828ea5875cf52ad9ae674f0.tar.gz |
Fixed Bug #52063 (DateTime constructor's second argument doesn't have a null default value)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/date/php_date.c | 4 | ||||
-rw-r--r-- | ext/date/tests/bug52063.phpt | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 75d2de186b..4cd62131bc 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2460,7 +2460,7 @@ PHP_FUNCTION(date_create) 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 @@ PHP_METHOD(DateTime, __construct) 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); diff --git a/ext/date/tests/bug52063.phpt b/ext/date/tests/bug52063.phpt new file mode 100644 index 0000000000..af9da9e429 --- /dev/null +++ b/ext/date/tests/bug52063.phpt @@ -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 |