web/lib/Zend/Date/DateObject.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    12  * obtain it through the world-wide-web, please send an email
    12  * obtain it through the world-wide-web, please send an email
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Date
    16  * @package    Zend_Date
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    17  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @version    $Id: DateObject.php 22712 2010-07-29 08:24:28Z thomas $
    18  * @version    $Id: DateObject.php 24880 2012-06-12 20:35:18Z matthew $
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @category   Zend
    23  * @category   Zend
    24  * @package    Zend_Date
    24  * @package    Zend_Date
    25  * @subpackage Zend_Date_DateObject
    25  * @subpackage Zend_Date_DateObject
    26  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    26  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    27  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    27  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    28  */
    28  */
    29 abstract class Zend_Date_DateObject {
    29 abstract class Zend_Date_DateObject {
    30 
    30 
    31     /**
    31     /**
   310             date_default_timezone_set($oldzone);
   310             date_default_timezone_set($oldzone);
   311             return $result;
   311             return $result;
   312         }
   312         }
   313 
   313 
   314         if (abs($timestamp) <= 0x7FFFFFFF) {
   314         if (abs($timestamp) <= 0x7FFFFFFF) {
       
   315             // See ZF-11992
       
   316             // "o" will sometimes resolve to the previous year (see 
       
   317             // http://php.net/date ; it's part of the ISO 8601 
       
   318             // standard). However, this is not desired, so replacing 
       
   319             // all occurrences of "o" not preceded by a backslash 
       
   320             // with "Y"
       
   321             $format = preg_replace('/(?<!\\\\)o\b/', 'Y', $format);
   315             $result = ($gmt) ? @gmdate($format, $timestamp) : @date($format, $timestamp);
   322             $result = ($gmt) ? @gmdate($format, $timestamp) : @date($format, $timestamp);
   316             date_default_timezone_set($oldzone);
   323             date_default_timezone_set($oldzone);
   317             return $result;
   324             return $result;
   318         }
   325         }
   319 
   326