Parcourir la source

[ZF-10150] Zend_Date:

- fixed tokens when using mb* with overloading

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22713 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas il y a 15 ans
Parent
commit
b73e81ebb9
2 fichiers modifiés avec 10 ajouts et 1 suppressions
  1. 1 1
      library/Zend/Date.php
  2. 9 0
      tests/Zend/DateTest.php

+ 1 - 1
library/Zend/Date.php

@@ -558,7 +558,7 @@ class Zend_Date extends Zend_Date_DateObject
         $comment = false;
         $format  = '';
         $orig    = '';
-        for ($i = 0; $i < strlen($part); ++$i) {
+        for ($i = 0; isset($part[$i]); ++$i) {
             if ($part[$i] == "'") {
                 $comment = $comment ? false : true;
                 if (isset($part[$i+1]) && ($part[$i+1] == "'")) {

+ 9 - 0
tests/Zend/DateTest.php

@@ -5665,6 +5665,15 @@ class Zend_DateTest extends PHPUnit_Framework_TestCase
 
         $this->assertTrue($date2->equals($date));
     }
+
+    /**
+     * @ZF-10150
+     */
+    public function testChineseFullDates()
+    {
+        $date = new Zend_Date(array('year' => 2008, 'month' => 10, 'day' => 12));
+        $this->assertEquals('2008年10月12日', $date->get(Zend_Date::DATE_LONG, 'zh'));
+    }
 }
 
 class Zend_Date_TestHelper extends Zend_Date