Merge branch 'develop' into 1.8

This commit is contained in:
MarkBaker 2016-06-05 16:46:46 +01:00
commit 650d2d099c
3 changed files with 47 additions and 7 deletions

View File

@ -353,34 +353,36 @@ class PHPExcel_Settings
}
/**
* Set default options for libxml loader
* Set options for libxml loader
*
* @param int $options Default options for libxml loader
* @param int $options Options for libxml loader
*/
public static function setLibXmlLoaderOptions($options = null)
{
if (is_null($options) && defined(LIBXML_DTDLOAD)) {
if (is_null($options) && defined('LIBXML_DTDLOAD')) {
$options = LIBXML_DTDLOAD | LIBXML_DTDATTR;
}
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
@libxml_disable_entity_loader($options == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
@libxml_disable_entity_loader((bool) $options);
}
self::$libXmlLoaderOptions = $options;
}
/**
* Get default options for libxml loader.
* Get defined options for libxml loader.
* Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
*
* @return int Default options for libxml loader
*/
public static function getLibXmlLoaderOptions()
{
if (is_null(self::$libXmlLoaderOptions) && defined(LIBXML_DTDLOAD)) {
if (is_null(self::$libXmlLoaderOptions) && defined('LIBXML_DTDLOAD')) {
self::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR);
} elseif (is_null(self::$libXmlLoaderOptions)) {
self::$libXmlLoaderOptions = true;
}
if (version_compare(PHP_VERSION, '5.2.11') >= 0) {
@libxml_disable_entity_loader(self::$libXmlLoaderOptions == (LIBXML_DTDLOAD | LIBXML_DTDATTR));
@libxml_disable_entity_loader((bool) self::$libXmlLoaderOptions);
}
return self::$libXmlLoaderOptions;
}

View File

@ -37,6 +37,12 @@ define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
$count = 39;
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($count);
var_dump($columnLetter);
die();
// Create new PHPExcel object
echo date('H:i:s') , " Create new PHPExcel object" , EOL;
$objPHPExcel = new PHPExcel();

View File

@ -0,0 +1,32 @@
<?php
class SettingsTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
}
require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
*/
public function testGetXMLSettings()
{
$result = call_user_func(array('PHPExcel_Settings','getLibXmlLoaderOptions'));
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
}
/**
*/
public function testSetXMLSettings()
{
call_user_func_array(array('PHPExcel_Settings','setLibXmlLoaderOptions'), [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]);
$result = call_user_func(array('PHPExcel_Settings','getLibXmlLoaderOptions'));
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
}
}