Project

General

Profile

Actions

Bug(バグ) #3291

open

opValidatorDate がタイムゾーンを考慮していない可能性がある.

Added by Yuya Watanabe about 12 years ago. Updated almost 5 years ago.

Status:
New(新規)
Priority:
Low(低め)
Assignee:
-
Target version:
Start date:
2013-01-10
Due date:
% Done:

0%

Estimated time:
3.6 で発生するか:
Unknown (未調査)
3.8 で発生するか:
Unknown (未調査)

Description

概要

後に示すテストコードを実行した際にパスしない. sfValidatorDate ではパスするため,もしかするとタイムゾーンの環境や設定によっては正しい動作をしない可能性がある.実際に起こりうる問題については調査しきれていないため、タイトル通り「可能性がある」という点でチケットを作成しておく.
問題点や修正点が明確になった場合はチケットタイトルおよびチケット本文を正しいものに差し替えてください.

テストコード

  1 <?php
  2 
  3 include_once dirname(__FILE__) . '/../../bootstrap/unit.php';
  4 
  5 $t = new lime_test(1, new lime_output_color());
  6 
  7 $v = new opValidatorDate();
  8 
  9 $t->diag('opValidatorDate');
 10 
 11 // timezones
 12 $defaultTimezone = new DateTimeZone(date_default_timezone_get());
 13 $otherTimezone = new DateTimeZone('US/Pacific');
 14 if ($defaultTimezone->getOffset(new DateTime()) == $otherTimezone->getOffset(new DateTime()))
 15 {
 16   $otherTimezone = new DateTimeZone('US/Eastern');
 17 }
 18 
 19 $date = new DateTime('2000-01-01T00:00:00-00:00');
 20 $date->setTimezone($otherTimezone);
 21 $v->setOption('with_time', true);
 22 $clean = $v->clean($date->format(DATE_ATOM));
 23 
 24 $date->setTimezone($defaultTimezone);
 25 $t->is($clean, $date->format('Y-m-d H:i:s'), '->clean() respects incoming and default timezones');

実行結果

$ php opValidatorDateTestForTimezone.php
not ok 1 - ->clean() respects incoming and default timezones
#     Failed test (./opValidatorDateTestForTimezone.php at line 25)
#            got: '1999-12-31 16:00:00'
#       expected: '2000-01-01 09:00:00'

関連チケット

Bug(バグ) #2882: opValidatorDate で「年」に 0 を入力した場合に空値として認識される - OpenPNE 3 - OpenPNE Issue Tracking System
https://redmine.openpne.jp/issues/2882#note-11


Related issues 1 (0 open1 closed)

Related to OpenPNE 3 - Bug(バグ) #2882: opValidatorDate で「年」に 0 を入力した場合に空値として認識されるWon't fix(対応せず)Yuya Watanabe2012-03-13

Actions
Actions #1

Updated by Yuya Watanabe about 12 years ago

  • Description updated (diff)
Actions #2

Updated by Chiharu Nakajima about 10 years ago

  • Priority changed from Normal(通常) to Low(低め)
Actions #3

Updated by Chiharu Nakajima about 10 years ago

このチケットの内容は下記の項目に該当する不具合であるため、一旦優先度を下げます。
・未対応でもユーザーに影響が少ない不具合(回避可能な不具合である等)

Actions #4

Updated by kaoru n almost 5 years ago

  • Target version set to OpenPNE 3.10.x
Actions

Also available in: Atom PDF