derick          Thu Dec 18 20:32:44 2008 UTC

  Modified files:              
    /php-src/ext/date   php_date.c 
    /php-src/ext/date/tests     bug46268.phpt 
  Log:
  - Fixed bug #46268 (DateTime::modify() does not reset relative time
    values).
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.214&r2=1.215&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.214 php-src/ext/date/php_date.c:1.215
--- php-src/ext/date/php_date.c:1.214   Thu Dec 18 14:54:50 2008
+++ php-src/ext/date/php_date.c Thu Dec 18 20:32:44 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.214 2008/12/18 14:54:50 derick Exp $ */
+/* $Id: php_date.c,v 1.215 2008/12/18 20:32:44 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2871,6 +2871,7 @@
 
        timelib_update_ts(dateobj->time, NULL);
        timelib_update_from_sse(dateobj->time);
+       dateobj->time->have_relative = 0;
 
        RETURN_ZVAL(object, 1, 0);
 }
@@ -2915,6 +2916,7 @@
 
        timelib_update_ts(dateobj->time, NULL);
        timelib_update_from_sse(dateobj->time);
+       dateobj->time->have_relative = 0;
 
        RETURN_ZVAL(object, 1, 0);
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug46268.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/date/tests/bug46268.phpt
diff -u /dev/null php-src/ext/date/tests/bug46268.phpt:1.2
--- /dev/null   Thu Dec 18 20:32:44 2008
+++ php-src/ext/date/tests/bug46268.phpt        Thu Dec 18 20:32:44 2008
@@ -0,0 +1,23 @@
+--TEST--
+Bug #46268 (When call DateTime#setTime, it seems to be called the last modify 
method too)
+--FILE--
+<?php
+date_default_timezone_set('Asia/Tokyo');
+
+$now = new DateTime('2008-10-10 01:02:03');
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 day after");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->modify("1 hour after");
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+
+$now->setTime(0, 0, 0);
+//date_time_set($now, 0, 0, 0);
+echo $now->format("Y-m-d H:i:s") . PHP_EOL;
+--EXPECT--
+2008-10-10 01:02:03
+2008-10-11 01:02:03
+2008-10-11 02:02:03
+2008-10-11 00:00:00



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

Reply via email to