diff --git a/CHANGELOG.md b/CHANGELOG.md index 342a960..9ab6d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,4 +48,14 @@ ### Features - Added `\PhpOffice\Common\File::fileGetContents()` (with support of zip://) -- Added Support for PHP 7.1 \ No newline at end of file +- Added Support for PHP 7.1 + +## 0.2.8 + +### Features +- Added possibility to register namespaces to DOMXpath +- Added Utility to get an Office compatible hash of a password +- Write attribute's value of type float independently of locale + +## 0.2.9 +- Fix XML Entity injection vulnerability \ No newline at end of file diff --git a/VERSION b/VERSION index 967b33f..d81f1c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.7 \ No newline at end of file +0.2.9 \ No newline at end of file diff --git a/composer.json b/composer.json index eed7fad..2a75a30 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "pclzip/pclzip": "^2.8" }, "require-dev": { - "phpunit/phpunit": "3.7.*", + "phpunit/phpunit": "^4.8.36 || ^7.0", "phpdocumentor/phpdocumentor":"2.*", "phpmd/phpmd": "2.*", "sebastian/phpcpd": "2.*", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2beeaba..7b09d34 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,8 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" - syntaxCheck="false"> + stopOnFailure="false"> ./tests/Common @@ -19,7 +18,7 @@ - + \ No newline at end of file diff --git a/src/Common/Microsoft/PasswordEncoder.php b/src/Common/Microsoft/PasswordEncoder.php index 4257557..f620f4c 100644 --- a/src/Common/Microsoft/PasswordEncoder.php +++ b/src/Common/Microsoft/PasswordEncoder.php @@ -164,7 +164,7 @@ private static function getAlgorithm($algorithmName) /** * Returns the algorithm ID * - * @param sting $algorithmName + * @param string $algorithmName * @return int */ public static function getAlgorithmId($algorithmName) diff --git a/src/Common/XMLReader.php b/src/Common/XMLReader.php index adc67ee..f804fb8 100644 --- a/src/Common/XMLReader.php +++ b/src/Common/XMLReader.php @@ -71,6 +71,7 @@ public function getDomFromZip($zipFile, $xmlFile) */ public function getDomFromString($content) { + libxml_disable_entity_loader(true); $this->dom = new \DOMDocument(); $this->dom->loadXML($content); diff --git a/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php b/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php index e0ca3bc..c95eae7 100644 --- a/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php +++ b/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php @@ -4,7 +4,7 @@ use PhpOffice\Common\Tests\TestHelperZip; -abstract class AbstractZipAdapterTest extends \PHPUnit_Framework_TestCase +abstract class AbstractZipAdapterTest extends \PHPUnit\Framework\TestCase { protected $zipTest; diff --git a/tests/Common/Tests/AutoloaderTest.php b/tests/Common/Tests/AutoloaderTest.php index 7ee8566..ff4c792 100644 --- a/tests/Common/Tests/AutoloaderTest.php +++ b/tests/Common/Tests/AutoloaderTest.php @@ -21,7 +21,7 @@ /** * Test class for Autoloader */ -class AutoloaderTest extends \PHPUnit_Framework_TestCase +class AutoloaderTest extends \PHPUnit\Framework\TestCase { /** * Register diff --git a/tests/Common/Tests/DrawingTest.php b/tests/Common/Tests/DrawingTest.php index 6b0b9b9..bbcf4e3 100644 --- a/tests/Common/Tests/DrawingTest.php +++ b/tests/Common/Tests/DrawingTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\IOFactory */ -class DrawingTest extends \PHPUnit_Framework_TestCase +class DrawingTest extends \PHPUnit\Framework\TestCase { /** */ diff --git a/tests/Common/Tests/FileTest.php b/tests/Common/Tests/FileTest.php index e19f796..439cc7b 100644 --- a/tests/Common/Tests/FileTest.php +++ b/tests/Common/Tests/FileTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\File */ -class FileTest extends \PHPUnit_Framework_TestCase +class FileTest extends \PHPUnit\Framework\TestCase { /** */ diff --git a/tests/Common/Tests/FontTest.php b/tests/Common/Tests/FontTest.php index 6d16f20..c661502 100644 --- a/tests/Common/Tests/FontTest.php +++ b/tests/Common/Tests/FontTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\Font */ -class FontTest extends \PHPUnit_Framework_TestCase +class FontTest extends \PHPUnit\Framework\TestCase { /** */ diff --git a/tests/Common/Tests/Microsoft/PasswordEncoderTest.php b/tests/Common/Tests/Microsoft/PasswordEncoderTest.php index d71fecd..b796575 100644 --- a/tests/Common/Tests/Microsoft/PasswordEncoderTest.php +++ b/tests/Common/Tests/Microsoft/PasswordEncoderTest.php @@ -22,7 +22,7 @@ * Test class for PhpOffice\Common\PasswordEncoder * @coversDefaultClass \PhpOffice\Common\PasswordEncoder */ -class PasswordEncoderTest extends \PHPUnit_Framework_TestCase +class PasswordEncoderTest extends \PHPUnit\Framework\TestCase { /** * Test that a password can be hashed without specifying any additional parameters diff --git a/tests/Common/Tests/TextTest.php b/tests/Common/Tests/TextTest.php index 0ee2c32..edd65e2 100644 --- a/tests/Common/Tests/TextTest.php +++ b/tests/Common/Tests/TextTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\Text */ -class TextTest extends \PHPUnit_Framework_TestCase +class TextTest extends \PHPUnit\Framework\TestCase { /** */ @@ -39,14 +39,14 @@ public function testControlCharacters() $this->assertEquals('', Text::controlCharacterOOXML2PHP('')); $this->assertEquals(chr(0x08), Text::controlCharacterOOXML2PHP('_x0008_')); } - + public function testNumberFormat() { $this->assertEquals('2.1', Text::numberFormat('2.06', 1)); $this->assertEquals('2.1', Text::numberFormat('2.12', 1)); - $this->assertEquals('1234', Text::numberFormat(1234, 1)); + $this->assertEquals('1234.0', Text::numberFormat(1234, 1)); } - + public function testChr() { $this->assertEquals('A', Text::chr(65)); diff --git a/tests/Common/Tests/XMLReaderTest.php b/tests/Common/Tests/XMLReaderTest.php index 44019fd..b0acde7 100644 --- a/tests/Common/Tests/XMLReaderTest.php +++ b/tests/Common/Tests/XMLReaderTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\XMLReader */ -class XMLReaderTest extends \PHPUnit_Framework_TestCase +class XMLReaderTest extends \PHPUnit\Framework\TestCase { /** * Test reading XML from string @@ -94,16 +94,19 @@ public function testReturnNullOnNonExistingNode() /** * Test that xpath fails if custom namespace is not registered - * - * @expectedException Exception */ public function testShouldThrowExceptionIfNamespaceIsNotKnown() { - $reader = new XMLReader(); - $reader->getDomFromString('AAA'); - - $this->assertTrue($reader->elementExists('/element/test:child')); - $this->assertEquals('AAA', $reader->getElement('/element/test:child')->textContent); + try { + $reader = new XMLReader(); + $reader->getDomFromString('AAA'); + + $this->assertTrue($reader->elementExists('/element/test:child')); + $this->assertEquals('AAA', $reader->getElement('/element/test:child')->textContent); + $this->fail(); + } catch (\Exception $e) { + $this->assertTrue(true); + } } /** diff --git a/tests/Common/Tests/XMLWriterTest.php b/tests/Common/Tests/XMLWriterTest.php index 4a1bb99..2ff2d2c 100644 --- a/tests/Common/Tests/XMLWriterTest.php +++ b/tests/Common/Tests/XMLWriterTest.php @@ -23,7 +23,7 @@ * * @coversDefaultClass PhpOffice\Common\XMLWriter */ -class XMLWriterTest extends \PHPUnit_Framework_TestCase +class XMLWriterTest extends \PHPUnit\Framework\TestCase { /** */