Browse Source

[ZF-8462] fixed php 5.3 specific bug/problem added test for that

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19390 44c647ce-9c0f-0410-b52a-842ac1e357ba
bate 16 years ago
parent
commit
0311f9d2cd
3 changed files with 26 additions and 1 deletions
  1. 1 1
      library/Zend/Pdf/Parser.php
  2. 25 0
      tests/Zend/Pdf/ActionTest.php
  3. BIN
      tests/Zend/Pdf/_files/ZF-8462.pdf

+ 1 - 1
library/Zend/Pdf/Parser.php

@@ -236,7 +236,7 @@ class Zend_Pdf_Parser
                 throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Wrong W dictionary entry. Only type field of stream entries has default value and could be zero length.', $offset));
             }
 
-            $xrefStreamData = &$xrefStream->value;
+            $xrefStreamData = $xrefStream->value;
 
             if ($trailerDict->Index !== null) {
                 if ($trailerDict->Index->getType() != Zend_Pdf_Element::TYPE_ARRAY) {

+ 25 - 0
tests/Zend/Pdf/ActionTest.php

@@ -371,4 +371,29 @@ class Zend_Pdf_ActionTest extends PHPUnit_Framework_TestCase
         $this->assertTrue($pdf->resolveDestination($action1->getDestination()) === $page2);
         $this->assertTrue($pdf->resolveDestination($action2->getDestination()) === null);
     }
+
+    /**
+     * @group ZF-8462
+     */
+    public function testPhpVersionBug()
+    {
+        if (!version_compare(phpversion(), '5.3.0', '>=')) {
+            $this->markTestSkipped('PHP Version must be 5.3.0 or higher');
+        }
+
+        try {
+            $file = '_files/ZF-8462.pdf';
+            $pdf = Zend_Pdf::load($file);
+        } catch (Zend_Pdf_Exception $e) {
+            // skip this Exception because that should happen
+            $error = error_get_last();
+            if ($error !== null && $error['type'] == E_WARNING) {
+                $this->fail('The expected bug exists. Please verify.');
+            }
+            // nothing happen no bug?
+            return;
+        }
+
+        $this->fail('An expected Exception has never been raised.');
+    }
 }

BIN
tests/Zend/Pdf/_files/ZF-8462.pdf