Changeset 1065

Show
Ignore:
Timestamp:
11/23/07 18:51:38 (11 months ago)
Author:
mikey
Message:

bugfix: handleErrors() needs to work without DOMDocument instance, too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/xml/stubXMLXIncludeStreamWrapper.php

    r1064 r1065  
    185185            $errors = libxml_get_errors(); 
    186186            libxml_clear_errors(); 
    187             $this->handleErrors($domDocument, $errors, $previousErrorHandling); 
     187            $this->handleErrors($errors, $previousErrorHandling); 
    188188        } 
    189189         
     
    197197            unlink($this->cachedFileName); 
    198198            libxml_clear_errors(); 
    199             $this->handleErrors($domDocument, $errors, $previousErrorHandling); 
     199            $this->handleErrors($errors, $previousErrorHandling, $domDocument); 
    200200        } 
    201201 
     
    214214     * @throws  stubXMLException 
    215215     */ 
    216     protected function handleErrors(DOMDocument $resultDoc, array $errors, $previousErrorHandling
     216    protected function handleErrors(array $errors, $previousErrorHandling, DOMDocument $resultDoc = null
    217217    { 
    218218        foreach ($errors as $error) { 
     
    220220            switch ($error->level) { 
    221221                case LIBXML_ERR_WARNING: 
    222                     $this->appendError($resultDoc, 'warning', $message); 
    223                     break; 
     222                    if (null !== $resultDoc) { 
     223                        $this->appendError($resultDoc, 'warning', $message); 
     224                        break; 
     225                    } 
     226                    // fallthru if no result doc given 
    224227                case LIBXML_ERR_ERROR: 
    225                     $this->appendError($resultDoc, 'error', $message); 
    226                     break; 
     228                    if (null !== $resultDoc) { 
     229                        $this->appendError($resultDoc, 'error', $message); 
     230                        break; 
     231                    } 
     232                    // fallthru if no result doc given 
    227233                case LIBXML_ERR_FATAL: 
    228234                    libxml_use_internal_errors($previousErrorHandling);