Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with PHP 8.0 #34

Closed
wants to merge 15 commits into from
12 changes: 9 additions & 3 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]

filter:
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*' ]

Expand All @@ -14,11 +20,11 @@ tools:
config:
ruleset: phpmd.xml.dist
external_code_coverage:
enabled: true
timeout: 900
enabled: false
timeout: 1200
php_cpd: true
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
# min_mass: 40
php_pdepend: true
php_analyzer: true
sensiolabs_security_checker: true
sensiolabs_security_checker: true
122 changes: 74 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,88 @@
language: php

dist: xenial

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- hhvm
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

matrix:
allow_failures:
- php: 7.1
- php: 7.2
- php: 7.3
- php: hhvm
include:
- php: 5.3
dist: precise
- php: 5.4
dist: trusty
- php: 5.5
dist: trusty
- php: 7.0
env: COVERAGE=1
- php: nightly
env: DEPENDENCIES="--ignore-platform-reqs"
exclude:
- php: 5.3
dist: xenial
- php: 5.4
dist: xenial
- php: 5.5
dist: xenial
allow_failures:
- php: nightly

#env:
# global:
# - secure: "LtlUOzC8FtqgbqUTmU7EU281NSCb58UFdvnz8lelNIDltBdP4eayN/TsgNIePB4jXg2d2R56ZA6j/grhE/md6jdUkulV355H3GrH/hIZmmQ+F9+87agnwLzb9+MJbqXoiE7VvjY3zGIO09G897SUfsfu6JWEcscYFlsH6KcXM6M="

env:
global:
## - secure: "LtlUOzC8FtqgbqUTmU7EU281NSCb58UFdvnz8lelNIDltBdP4eayN/TsgNIePB4jXg2d2R56ZA6j/grhE/md6jdUkulV355H3GrH/hIZmmQ+F9+87agnwLzb9+MJbqXoiE7VvjY3zGIO09G897SUfsfu6JWEcscYFlsH6KcXM6M="
before_install:
## Packages
- sudo rm -f /etc/apt/sources.list.d/mongodb.list # Makes apt crash on Precise, and we don't need MongoDB
- sudo apt-get update -qq
- sudo apt-get install -y graphviz

before_script:
## Packages
- sudo apt-get -qq update > /dev/null
- sudo apt-get -qq install graphviz > /dev/null
## Composer
- composer self-update
- composer install --prefer-source --dev
## PHPDocumentor
- mkdir -p build/docs
- mkdir -p build/coverage
## Deactivate xdebug if we don't do code coverage
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini || echo "xdebug not available" ; fi
## Composer
- composer self-update
## Composer in PHP versions 5.x requires 3 GB memory
- if [ ${TRAVIS_PHP_VERSION:0:2} == "5." ]; then export COMPOSER_MEMORY_LIMIT=3G ; fi
- travis_wait composer install --prefer-source $(if [ -n "$DEPENDENCIES" ]; then echo $DEPENDENCIES; fi)
## PHPDocumentor
- mkdir -p build/docs
- mkdir -p build/coverage

script:
## PHP_CodeSniffer
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n
## PHP Copy/Paste Detector
# - ./vendor/bin/phpcpd src/
## PHP Mess Detector
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist
## PHPUnit
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
## PHPLOC
- ./vendor/bin/phploc src/
## PHPDocumentor
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --template="responsive-twig"
## PHP_CodeSniffer
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n ; fi
## PHP Copy/Paste Detector
# - ./vendor/bin/phpcpd src/
## PHP Mess Detector
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist ; fi
## PHPUnit
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text --coverage-html ./build/coverage; else echo --no-coverage; fi)
## PHPLOC
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
## PHPDocumentor
#- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --template="responsive-twig" ; fi

after_script:
## PHPDocumentor
## - bash .travis_shell_after_success.sh
## Scrutinizer
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
## PHPDocumentor
## - bash .travis_shell_after_success.sh
## Scrutinizer
- if [ -z "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar ; fi
- if [ -z "$COVERAGE" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/e019b92a7793d27e080c
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
webhooks:
urls:
- https://webhooks.gitter.im/e/e019b92a7793d27e080c
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"phpunit/phpunit": "^4.8.36 || ^7.0",
"phpdocumentor/phpdocumentor":"2.*",
"phpmd/phpmd": "2.*",
"sebastian/phpcpd": "2.*",
"phploc/phploc": "2.*",
"squizlabs/php_codesniffer": "2.*"
"sebastian/phpcpd": "2.* || 3.* || 4.* || 5.* || 6.*",
"phploc/phploc": "2.* || 3.* || 4.* || 5.* || 6.* || 7.*",
"squizlabs/php_codesniffer": "2.* || ^3.5"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 6 additions & 2 deletions src/Common/XMLReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ public function getDomFromZip($zipFile, $xmlFile)
*/
public function getDomFromString($content)
{
$originalLibXMLEntityValue = libxml_disable_entity_loader(true);
if (\PHP_VERSION_ID < 80000) {
$originalLibXMLEntityValue = libxml_disable_entity_loader(true);
}
$this->dom = new \DOMDocument();
$this->dom->loadXML($content);
libxml_disable_entity_loader($originalLibXMLEntityValue);
if (\PHP_VERSION_ID < 80000) {
libxml_disable_entity_loader($originalLibXMLEntityValue);
}

return $this->dom;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function testAddFromString()

$adapter = $this->createAdapter();
$adapter->open($this->zipTest);
$this->assertSame($adapter, $adapter->addFromString($expectedPath, $expectedContent));
// pclzip/pclzip library trow notice/warning in PHP 7.1+, issue: https://github.com/ivanlanin/pclzip/pull/8
@$this->assertSame($adapter, $adapter->addFromString($expectedPath, $expectedContent));
$adapter->close();

$this->assertTrue(TestHelperZip::assertFileExists($this->zipTest, $expectedPath));
Expand Down
1 change: 0 additions & 1 deletion tests/Common/Tests/XMLWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function testWriteAttributeShouldWriteFloatValueLocaleIndependent()

setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de');

$this->assertSame('1,2', (string)$value);
$this->assertSame('<element name="1.2"/>' . chr(10), $xmlWriter->getData());
}
}