public

Patch to Zend Framework 1.11.4 to add filename to exception description when TMX parsing fails

  • Download Gist
tmx_filename_patch_to_zf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Index: library/Zend/Translate/Adapter/Tmx.php
===================================================================
--- library/Zend/Translate/Adapter/Tmx.php (revision 3015)
+++ library/Zend/Translate/Adapter/Tmx.php (working copy)
@@ -74,9 +74,10 @@
xml_set_character_data_handler($this->_file, "_contentElement");
if (!xml_parse($this->_file, file_get_contents($filename))) {
- $ex = sprintf('XML error: %s at line %d',
+ $ex = sprintf('XML error: %s at line %d of file %s',
xml_error_string(xml_get_error_code($this->_file)),
- xml_get_current_line_number($this->_file));
+ xml_get_current_line_number($this->_file),
+ $filename);
xml_parser_free($this->_file);
require_once 'Zend/Translate/Exception.php';
throw new Zend_Translate_Exception($ex);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.