diff -Nru php-tokenizer-1.1.0/CHANGELOG.md php-tokenizer-1.1.3/CHANGELOG.md --- php-tokenizer-1.1.0/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ php-tokenizer-1.1.3/CHANGELOG.md 2019-06-13 22:48:21.000000000 +0000 @@ -0,0 +1,32 @@ +# Changelog + +All notable changes to Tokenizer are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. + +## [1.1.2] - 2019-04-04 + +### Changed + +* Reverted PHPUnit 8 test update to stay PHP 7.0 compliant + + +## [1.1.1] - 2019-04-03 + +### Fixed + +* [#1](https://github.com/theseer/tokenizer/issues/1): Empty file causes invalid array read + +### Changed + +* Tests should now be PHPUnit 8 compliant + + +## [1.1.0] - 2017-04-07 + +### Added + +* Allow use of custom namespace for XML serialization + + +## [1.0.0] - 2017-04-05 + +Initial Release diff -Nru php-tokenizer-1.1.0/debian/changelog php-tokenizer-1.1.3/debian/changelog --- php-tokenizer-1.1.0/debian/changelog 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/changelog 2019-08-15 20:38:52.000000000 +0000 @@ -1,5 +1,39 @@ +php-tokenizer (1.1.3-2) unstable; urgency=medium + + * Upload to unstable now that buster has been released + * Update standards version, no changes needed. + * Set upstream metadata fields: Contact, Name. + * Compatibility with recent PHPUnit (8) + + -- David Prévot Thu, 15 Aug 2019 10:38:52 -1000 + +php-tokenizer (1.1.3-1) experimental; urgency=medium + + [ Arne Blankerts ] + * Ensure XMLSerializer can deal with empty token collections + + -- David Prévot Thu, 20 Jun 2019 12:21:00 -1000 + +php-tokenizer (1.1.2-1) experimental; urgency=medium + + * Upload to experimental during the freeze + + [ Arne Blankerts ] + * Update for 1.1.2 + + [ David Prévot ] + * Fix php-codecoverage name in previous changelog entry + * Move repository to salsa.d.o + * Use debhelper-compat 12 + * Use https in Format + * Drop get-orig-source target + * Update Standards-Version to 4.3.0 + * Use now provided upstream changelog + + -- David Prévot Sat, 06 Apr 2019 18:08:45 -1000 + php-tokenizer (1.1.0-1) unstable; urgency=low - * Initial Release (New php-coverage dependency) + * Initial Release (New php-codecoverage dependency) -- David Prévot Wed, 23 Aug 2017 12:41:08 -1000 diff -Nru php-tokenizer-1.1.0/debian/clean php-tokenizer-1.1.3/debian/clean --- php-tokenizer-1.1.0/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ php-tokenizer-1.1.3/debian/clean 2019-08-15 20:38:34.000000000 +0000 @@ -0,0 +1 @@ +.phpunit.result.cache diff -Nru php-tokenizer-1.1.0/debian/compat php-tokenizer-1.1.3/debian/compat --- php-tokenizer-1.1.0/debian/compat 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru php-tokenizer-1.1.0/debian/control php-tokenizer-1.1.3/debian/control --- php-tokenizer-1.1.0/debian/control 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/control 2019-08-15 20:37:38.000000000 +0000 @@ -4,11 +4,11 @@ Maintainer: Debian PHP PEAR Maintainers Uploaders: David Prévot , Prach Pongpanich -Build-Depends: ant, debhelper (>= 9), phpab, phpunit, pkg-php-tools -Standards-Version: 4.1.0 +Build-Depends: ant, debhelper-compat (= 12), phpab, phpunit, pkg-php-tools +Standards-Version: 4.4.0 Homepage: https://github.com/theseer/Tokenizer -Vcs-Git: https://anonscm.debian.org/git/pkg-php/php-tokenizer.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-php/php-tokenizer.git +Vcs-Git: https://salsa.debian.org/php-team/pear/php-tokenizer.git +Vcs-Browser: https://salsa.debian.org/php-team/pear/php-tokenizer Package: php-tokenizer Architecture: all diff -Nru php-tokenizer-1.1.0/debian/copyright php-tokenizer-1.1.3/debian/copyright --- php-tokenizer-1.1.0/debian/copyright 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/copyright 2019-08-15 20:34:59.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Tokenizer Upstream-Contact: Arne Blankerts Source: https://github.com/theseer/Tokenizer diff -Nru php-tokenizer-1.1.0/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch php-tokenizer-1.1.3/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch --- php-tokenizer-1.1.0/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-tokenizer-1.1.3/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch 2019-08-15 20:37:38.000000000 +0000 @@ -0,0 +1,49 @@ +From: =?utf-8?q?David_Pr=C3=A9vot?= +Date: Thu, 15 Aug 2019 10:37:28 -1000 +Subject: Compatibility with recent PHPUnit (8) + +--- + tests/TokenCollectionTest.php | 2 +- + tests/TokenTest.php | 2 +- + tests/XMLSerializerTest.php | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/TokenCollectionTest.php b/tests/TokenCollectionTest.php +index 1f3b7d9..191aeae 100644 +--- a/tests/TokenCollectionTest.php ++++ b/tests/TokenCollectionTest.php +@@ -11,7 +11,7 @@ class TokenCollectionTest extends TestCase { + /** @var TokenCollection */ + private $collection; + +- protected function setUp() { ++ protected function setUp(): void { + $this->collection = new TokenCollection(); + } + +diff --git a/tests/TokenTest.php b/tests/TokenTest.php +index 2091d4b..9003d16 100644 +--- a/tests/TokenTest.php ++++ b/tests/TokenTest.php +@@ -8,7 +8,7 @@ class TokenTest extends TestCase { + /** @var Token */ + private $token; + +- protected function setUp() { ++ protected function setUp(): void { + $this->token = new Token(1,'test-dummy', 'blank'); + } + +diff --git a/tests/XMLSerializerTest.php b/tests/XMLSerializerTest.php +index 48f4329..a99b82d 100644 +--- a/tests/XMLSerializerTest.php ++++ b/tests/XMLSerializerTest.php +@@ -11,7 +11,7 @@ class XMLSerializerTest extends TestCase { + /** @var TokenCollection $tokens */ + private $tokens; + +- protected function setUp() { ++ protected function setUp(): void { + $this->tokens = unserialize( + file_get_contents(__DIR__ . '/_files/test.php.tokens'), + [TokenCollection::class] diff -Nru php-tokenizer-1.1.0/debian/patches/series php-tokenizer-1.1.3/debian/patches/series --- php-tokenizer-1.1.0/debian/patches/series 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/patches/series 2019-08-15 20:37:38.000000000 +0000 @@ -1 +1,2 @@ 0001-Adapt-upstream-build-system-to-Debian-expectations.patch +0002-Compatibility-with-recent-PHPUnit-8.patch diff -Nru php-tokenizer-1.1.0/debian/rules php-tokenizer-1.1.3/debian/rules --- php-tokenizer-1.1.0/debian/rules 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/rules 2019-08-15 20:37:38.000000000 +0000 @@ -8,9 +8,3 @@ else @echo "** tests disabled" endif - -override_dh_installchangelogs: - dh_installchangelogs debian/upstream/changelog - -get-orig-source: - uscan --verbose --force --rename diff -Nru php-tokenizer-1.1.0/debian/upstream/changelog php-tokenizer-1.1.3/debian/upstream/changelog --- php-tokenizer-1.1.0/debian/upstream/changelog 2017-08-23 22:41:08.000000000 +0000 +++ php-tokenizer-1.1.3/debian/upstream/changelog 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -1.1.0 - Apr 7, 2017 - - Allow use of custom namespace for XML serialization - -1.0.0 - Apr 5, 2017 diff -Nru php-tokenizer-1.1.0/debian/upstream/metadata php-tokenizer-1.1.3/debian/upstream/metadata --- php-tokenizer-1.1.0/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ php-tokenizer-1.1.3/debian/upstream/metadata 2019-08-15 20:37:38.000000000 +0000 @@ -0,0 +1,2 @@ +Name: Tokenizer +Contact: Arne Blankerts diff -Nru php-tokenizer-1.1.0/.gitignore php-tokenizer-1.1.3/.gitignore --- php-tokenizer-1.1.0/.gitignore 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/.gitignore 2019-06-13 22:48:21.000000000 +0000 @@ -5,3 +5,4 @@ /tools /vendor /build +/.phpunit.result.cache diff -Nru php-tokenizer-1.1.0/phive.xml php-tokenizer-1.1.3/phive.xml --- php-tokenizer-1.1.0/phive.xml 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/phive.xml 2019-06-13 22:48:21.000000000 +0000 @@ -1,5 +1,5 @@ - - + + diff -Nru php-tokenizer-1.1.0/src/Tokenizer.php php-tokenizer-1.1.3/src/Tokenizer.php --- php-tokenizer-1.1.0/src/Tokenizer.php 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/src/Tokenizer.php 2019-06-13 22:48:21.000000000 +0000 @@ -41,6 +41,11 @@ public function parse(string $source): TokenCollection { $result = new TokenCollection(); + + if ($source === '') { + return $result; + } + $tokens = token_get_all($source); $lastToken = new Token( diff -Nru php-tokenizer-1.1.0/src/XMLSerializer.php php-tokenizer-1.1.3/src/XMLSerializer.php --- php-tokenizer-1.1.0/src/XMLSerializer.php 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/src/XMLSerializer.php 2019-06-13 22:48:21.000000000 +0000 @@ -57,12 +57,15 @@ $this->writer->startDocument(); $this->writer->startElement('source'); $this->writer->writeAttribute('xmlns', $this->xmlns->asString()); - $this->writer->startElement('line'); - $this->writer->writeAttribute('no', '1'); - $this->previousToken = $tokens[0]; - foreach ($tokens as $token) { - $this->addToken($token); + if (count($tokens) > 0) { + $this->writer->startElement('line'); + $this->writer->writeAttribute('no', '1'); + + $this->previousToken = $tokens[0]; + foreach ($tokens as $token) { + $this->addToken($token); + } } $this->writer->endElement(); diff -Nru php-tokenizer-1.1.0/tests/_files/empty.xml php-tokenizer-1.1.3/tests/_files/empty.xml --- php-tokenizer-1.1.0/tests/_files/empty.xml 1970-01-01 00:00:00.000000000 +0000 +++ php-tokenizer-1.1.3/tests/_files/empty.xml 2019-06-13 22:48:21.000000000 +0000 @@ -0,0 +1,2 @@ + + diff -Nru php-tokenizer-1.1.0/tests/XMLSerializerTest.php php-tokenizer-1.1.3/tests/XMLSerializerTest.php --- php-tokenizer-1.1.0/tests/XMLSerializerTest.php 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/tests/XMLSerializerTest.php 2019-06-13 22:48:21.000000000 +0000 @@ -40,4 +40,11 @@ $this->assertEquals($expected, $serializer->toXML($this->tokens)); } + public function testEmptyCollectionCreatesEmptyDocument() { + $expected = file_get_contents(__DIR__ . '/_files/empty.xml'); + + $serializer = new XMLSerializer(); + $this->assertEquals($expected, $serializer->toXML((new TokenCollection()))); + } + } diff -Nru php-tokenizer-1.1.0/.travis.yml php-tokenizer-1.1.3/.travis.yml --- php-tokenizer-1.1.0/.travis.yml 2017-04-07 12:08:54.000000000 +0000 +++ php-tokenizer-1.1.3/.travis.yml 2019-06-13 22:48:21.000000000 +0000 @@ -17,11 +17,12 @@ script: ./tools/phpunit php: - - 5.6 - 7.0 - 7.1 - 7.0snapshot - 7.1snapshot + - 7.2 + - 7.3 - master matrix: