From c2554b4bb43700ae16db34d9706db1db85ec78a4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 1 Dec 2012 10:20:39 +0100 Subject: Fixed Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond When storing '015700' microseconds in a Datetime object, Datetime::format('u') returns '015699' Already known per bug45554 reproducer (also fixed). --- ext/date/php_date.c | 2 +- ext/date/tests/bug45554.phpt | 4 ++-- ext/date/tests/bug63435.phpt | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 ext/date/tests/bug63435.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e8a457052e..47b79bc250 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1095,7 +1095,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca case 'H': length = slprintf(buffer, 32, "%02d", (int) t->h); break; case 'i': length = slprintf(buffer, 32, "%02d", (int) t->i); break; case 's': length = slprintf(buffer, 32, "%02d", (int) t->s); break; - case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000)); break; + case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000 + 0.5)); break; /* timezone */ case 'I': length = slprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break; diff --git a/ext/date/tests/bug45554.phpt b/ext/date/tests/bug45554.phpt index 0e9ebfd140..a5042ffb1c 100644 --- a/ext/date/tests/bug45554.phpt +++ b/ext/date/tests/bug45554.phpt @@ -9,12 +9,12 @@ $d = date_create_from_format($format, "03-15-2005 12:22:29.000000 PST"); echo $d->format($format), "\n"; $d = date_create_from_format($format, "03-15-2005 12:22:29.001001 PST"); -echo $d->format($format), " (precision isn't enough to show the 1 here)\n"; +echo $d->format($format), "\n"; $d = date_create_from_format($format, "03-15-2005 12:22:29.0010 PST"); echo $d->format($format), "\n"; ?> --EXPECT-- 03-15-2005 12:22:29.000000 PST -03-15-2005 12:22:29.001000 PST (precision isn't enough to show the 1 here) +03-15-2005 12:22:29.001001 PST 03-15-2005 12:22:29.001000 PST diff --git a/ext/date/tests/bug63435.phpt b/ext/date/tests/bug63435.phpt new file mode 100644 index 0000000000..dcec6e46e7 --- /dev/null +++ b/ext/date/tests/bug63435.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond +--INI-- +date.timezone=UTC +--FILE-- +format("u"); + if ($res != $i) { + echo "$i != $res\n"; + } +} +echo "Done"; +--EXPECT-- +Done -- cgit v1.2.1 From 31ab57e052925305008c20e787f514c159d3469d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 1 Dec 2012 10:25:37 +0100 Subject: NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 5022c763c3..348ab8f853 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ PHP NEWS - Apache2 Handler SAPI: . Enabled Apache 2.4 configure option for Windows (Pierre, Anatoliy) +- Date: + . Fixed bug #63435 (Datetime::format('u') sometimes wrong by 1 microsecon). + (Remi) + - Fileinfo: . Fixed bug #63248 (Load multiple magic files from a directory under Windows). (Anatoliy) -- cgit v1.2.1 From 94cbd6374adcb3e2ac15303dd47a212953f93e98 Mon Sep 17 00:00:00 2001 From: Anatoliy Belsky Date: Wed, 5 Dec 2012 09:55:49 +0100 Subject: Two tests deactivated until #63688 was fixed --- tests/lang/034.phpt | 4 ++++ tests/lang/bug30638.phpt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt index 5d2c610926..cea0797d69 100644 --- a/tests/lang/034.phpt +++ b/tests/lang/034.phpt @@ -4,6 +4,10 @@ Bug #12647 (Locale settings affecting float parsing) precision=14 --SKIPIF-- Date: Wed, 5 Dec 2012 18:55:05 +0100 Subject: this will become PHP 5.3.21 --- NEWS | 4 ++++ configure.in | 2 +- main/php_version.h | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 348ab8f853..1ec60e3dfe 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 2013, PHP 5.3.21 + ?? ??? 2012, PHP 5.3.20 +#### ADD NEWS TO 5.3.21 ONLY #### + - Zend Engine: . Fixed bug #63635 (Segfault in gc_collect_cycles). (Dmitry) . Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes diff --git a/configure.in b/configure.in index 66900b455c..72cdee53d9 100644 --- a/configure.in +++ b/configure.in @@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h) PHP_MAJOR_VERSION=5 PHP_MINOR_VERSION=3 -PHP_RELEASE_VERSION=20 +PHP_RELEASE_VERSION=21 PHP_EXTRA_VERSION="-dev" PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` diff --git a/main/php_version.h b/main/php_version.h index 331f30a051..f34c957567 100644 --- a/main/php_version.h +++ b/main/php_version.h @@ -2,7 +2,7 @@ /* edit configure.in to change version number */ #define PHP_MAJOR_VERSION 5 #define PHP_MINOR_VERSION 3 -#define PHP_RELEASE_VERSION 20 +#define PHP_RELEASE_VERSION 21 #define PHP_EXTRA_VERSION "-dev" -#define PHP_VERSION "5.3.20-dev" -#define PHP_VERSION_ID 50320 +#define PHP_VERSION "5.3.21-dev" +#define PHP_VERSION_ID 50321 -- cgit v1.2.1