stas                                     Sun, 30 Jan 2011 10:18:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307853

Log:
Fix bug #52290 (setDate, setISODate, setTime works wrong when DateTime created 
from timestamp)

Bug: http://bugs.php.net/52290 (Assigned) setDate, setISODate, setTime works 
wrong when DateTime created from timestamp
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/date/php_date.c
    U   php/php-src/branches/PHP_5_3/ext/date/tests/bug52290.phpt
    U   php/php-src/trunk/ext/date/php_date.c
    U   php/php-src/trunk/ext/date/tests/bug52290.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-01-30 09:28:54 UTC (rev 307852)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-01-30 10:18:12 UTC (rev 307853)
@@ -41,6 +41,8 @@
   . Fixed bug #52808 (Segfault when specifying interval as two dates). (Stas)
   . Fixed bug #52738 (Can't use new properties in class extended from
     DateInterval). (Stas)
+  . Fixed bug #52290 (setDate, setISODate, setTime works wrong when DateTime
+    created from timestamp). (Stas)
   . Fixed bug #52063 (DateTime constructor's second argument doesn't have a
     null default value). (Gustavo, Stas)


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-30 09:28:54 UTC 
(rev 307852)
+++ php/php-src/branches/PHP_5_3/ext/date/php_date.c    2011-01-30 10:18:12 UTC 
(rev 307853)
@@ -3090,6 +3090,7 @@
        dateobj->time->y = y;
        dateobj->time->m = 1;
        dateobj->time->d = 1;
+       memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
        dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
        dateobj->time->have_relative = 1;


Modified: php/php-src/branches/PHP_5_3/ext/date/tests/bug52290.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/bug52290.phpt   2011-01-30 
09:28:54 UTC (rev 307852)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52290.phpt   2011-01-30 
10:18:12 UTC (rev 307853)
@@ -23,5 +23,5 @@
 --EXPECTF--
 string(47) "2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600"
 string(47) "2005-W52-1 | 2005-12-26 | 00:00:00 | 1135555200"
-string(47) "2007-W40-5 | 2007-10-10 | 00:00:00 | 1191974400"
-string(47) "2007-W40-5 | 2007-10-10 | 20:30:40 | 1192048240"
\ No newline at end of file
+string(47) "2007-W41-3 | 2007-10-10 | 00:00:00 | 1191974400"
+string(47) "2007-W41-3 | 2007-10-10 | 20:30:40 | 1192048240"
\ No newline at end of file

Modified: php/php-src/trunk/ext/date/php_date.c
===================================================================
--- php/php-src/trunk/ext/date/php_date.c       2011-01-30 09:28:54 UTC (rev 
307852)
+++ php/php-src/trunk/ext/date/php_date.c       2011-01-30 10:18:12 UTC (rev 
307853)
@@ -3085,6 +3085,7 @@
        dateobj->time->y = y;
        dateobj->time->m = 1;
        dateobj->time->d = 1;
+       memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
        dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
        dateobj->time->have_relative = 1;


Modified: php/php-src/trunk/ext/date/tests/bug52290.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug52290.phpt      2011-01-30 09:28:54 UTC 
(rev 307852)
+++ php/php-src/trunk/ext/date/tests/bug52290.phpt      2011-01-30 10:18:12 UTC 
(rev 307853)
@@ -23,5 +23,5 @@
 --EXPECTF--
 string(47) "2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600"
 string(47) "2005-W52-1 | 2005-12-26 | 00:00:00 | 1135555200"
-string(47) "2007-W40-5 | 2007-10-10 | 00:00:00 | 1191974400"
-string(47) "2007-W40-5 | 2007-10-10 | 20:30:40 | 1192048240"
\ No newline at end of file
+string(47) "2007-W41-3 | 2007-10-10 | 00:00:00 | 1191974400"
+string(47) "2007-W41-3 | 2007-10-10 | 20:30:40 | 1192048240"
\ No newline at end of file

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to