Skip to content

Instantly share code, notes, and snippets.

@hacklschorsch
Created January 19, 2012 17:27
Show Gist options
  • Save hacklschorsch/1641340 to your computer and use it in GitHub Desktop.
Save hacklschorsch/1641340 to your computer and use it in GitHub Desktop.
Patch to Zend Framework 1.11.4 to add filename to exception description when TMX parsing fails
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment