Ver código fonte

Zend_Pdf: fix bug in multi-level outlines loading.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23194 44c647ce-9c0f-0410-b52a-842ac1e357ba
alexander 15 anos atrás
pai
commit
8a1ad392a6
1 arquivos alterados com 5 adições e 7 exclusões
  1. 5 7
      library/Zend/Pdf/Outline/Loaded.php

+ 5 - 7
library/Zend/Pdf/Outline/Loaded.php

@@ -335,8 +335,11 @@ class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline
             $childOutlinesCount = abs($childOutlinesCount);
 
             $childDictionary = $dictionary->First;
-            for ($count = 0; $count < $childOutlinesCount; $count++) {
-                if ($childDictionary === null) {
+
+            $children = new SplObjectStorage();
+            while ($childDictionary !== null) {
+                // Check children structure for cyclic references
+                if ($children->contains($childDictionary)) {
                     require_once 'Zend/Pdf/Exception.php';
                     throw new Zend_Pdf_Exception('Outline childs load error.');
                 }
@@ -348,11 +351,6 @@ class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline
                 $childDictionary = $childDictionary->Next;
             }
 
-            if ($childDictionary !== null) {
-                require_once 'Zend/Pdf/Exception.php';
-                throw new Zend_Pdf_Exception('Outline childs load error.');
-            }
-
             $this->_originalChildOutlines = $this->childOutlines;
         }
     }