Kaynağa Gözat

ZF-9450: fixed issue with Zend_Pdf_Element_String::unescape and octal notation

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21542 44c647ce-9c0f-0410-b52a-842ac1e357ba
bate 16 yıl önce
ebeveyn
işleme
abb866ecf4

+ 1 - 1
library/Zend/Pdf/Element/String.php

@@ -246,7 +246,7 @@ class Zend_Pdf_Element_String extends Zend_Pdf_Element
                                 }
                             }
 
-                            $outEntries[] = chr($nextCode);
+                            $outEntries[] = chr(octdec($nextCode));
                         } else {
                             $outEntries[] = $str[$offset];
                         }

+ 21 - 0
tests/Zend/Pdf/Element/StringTest.php

@@ -21,6 +21,11 @@
  */
 
 /**
+ * TestHelper
+ */
+require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
+
+/**
  * Zend_Pdf_Element_String
  */
 require_once 'Zend/Pdf/Element/String.php';
@@ -68,4 +73,20 @@ class Zend_Pdf_Element_StringTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(Zend_Pdf_Element_String::unescape("\\n\\r\\t\\b\\f\\(\\)\\\\  \nsome \\\ntext"),
                             "\n\r\t\x08\x0C()\\  \nsome text");
     }
+
+    /**
+     * @group ZF-9450
+     */
+    public function testUnescapeOctal()
+    {
+        $input = array(
+            0304 => '\\304',
+            0326 => '\\326',
+            0334 => '\\334'
+        );
+        foreach ($input as $k => $v) {
+            $this->assertEquals(Zend_Pdf_Element_String::unescape($v),
+                chr($k), 'expected German Umlaut');
+        }
+    }
 }