ZF-2262: xml_parser_free() called after exception is thrown

Description

Line 95, Zend/Translate/Adapter/Tbx.php


if (!xml_parse($this->_file, file_get_contents($filename))) {
            throw new Zend_Translate_Exception(sprintf('XML error: %s at line %d',
                      xml_error_string(xml_get_error_code($this->_file)),
                      xml_get_current_line_number($this->_file)));
            xml_parser_free($this->_file);
        }

I would suggest the following:


        if (!xml_parse($this->_file, file_get_contents($filename))) {
            $exception = new Zend_Translate_Exception(sprintf('XML error: %s at line %d',
                      xml_error_string(xml_get_error_code($this->_file)),
                      xml_get_current_line_number($this->_file)));
            xml_parser_free($this->_file);
            throw $exception;
        }

Comments

Same for Zend_Translate_Adapter_Xliff, Zend_Translate_Adapter_XmlTm, Zend_Translate_Adapter_Tmx and Zend_Translate_Adapter_Qt

Fixes the described problems

Thanks for your suggestion...

I will look over it and see what we will do. You will get an answer in some days.

Thanks for your interest and investigation related to this issue.

It is fixed with SVN-7049 within the trunk.