diff --git a/Classes/PHPExcel/Reader/HTML.php b/Classes/PHPExcel/Reader/HTML.php index 3a59bb16b..6adcc857a 100644 --- a/Classes/PHPExcel/Reader/HTML.php +++ b/Classes/PHPExcel/Reader/HTML.php @@ -424,7 +424,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) // Create a new DOM object $dom = new DOMDocument; // Reload the HTML file into the DOM object - if (version_compare(PHP_VERSION, '5.4.0') >= 0) { + if ((version_compare(PHP_VERSION, '5.4.0') >= 0) && defined(LIBXML_DTDLOAD)) { $loaded = $dom->loadHTMLFile($pFilename, PHPExcel_Settings::getLibXmlLoaderOptions()); } else { $loaded = $dom->loadHTMLFile($pFilename); diff --git a/Classes/PHPExcel/Settings.php b/Classes/PHPExcel/Settings.php index d9d197a55..c78d9350d 100644 --- a/Classes/PHPExcel/Settings.php +++ b/Classes/PHPExcel/Settings.php @@ -363,10 +363,12 @@ public static function getPdfRendererPath() */ public static function setLibXmlLoaderOptions($options = null) { - if (is_null($options)) { + if (is_null($options) && defined(LIBXML_DTDLOAD)) { $options = LIBXML_DTDLOAD | LIBXML_DTDATTR; } - @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + if (version_compare(PHP_VERSION, '5.2.11') >= 0) { + @libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + } self::$_libXmlLoaderOptions = $options; } // function setLibXmlLoaderOptions @@ -378,10 +380,12 @@ public static function setLibXmlLoaderOptions($options = null) */ public static function getLibXmlLoaderOptions() { - if (is_null(self::$_libXmlLoaderOptions)) { + if (is_null(self::$_libXmlLoaderOptions) && defined(LIBXML_DTDLOAD)) { self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR); } - @libxml_disable_entity_loader(self::$_libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + if (version_compare(PHP_VERSION, '5.2.11') >= 0) { + @libxml_disable_entity_loader(self::$_libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR)); + } return self::$_libXmlLoaderOptions; } // function getLibXmlLoaderOptions } diff --git a/changelog.txt b/changelog.txt index 8e4a5f6e5..12794548c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,7 +29,7 @@ Planned for v1.8.1 - Bugfix: (MBaker) - Fix to ensure that current cell is maintained when executing formula calculations - Bugfix: (MBaker) Work Item GH-350 - Keep/set the value on Reader _loadSheetsOnly as NULL, courtesy of Restless-ET - Bugfix: (MBaker) Work Item CP18105 - Loading an Excel 2007 spreadsheet throws an "Autofilter must be set on a range of cells" exception -- Bugfix: (MBaker) - Fix to autoloader registration for backward compatibility with PHP 5.2.0 not accepting the prepend flag +- Bugfix: (MBaker) Work Item GH-388 - Fix to autoloader registration for backward compatibility with PHP 5.2.0 not accepting the prepend flag - Bugfix: (MBaker) Work Item GH-384 - DOM loadHTMLFile() failing with options flags when using PHP < 5.4.0 - Bugfix: (MBaker) - Fix for percentage operator in formulae for BIFF Writer - General: (MBaker) - Small performance improvement for autosize columns