Compare commits

...

18 Commits

Author SHA1 Message Date
troosan
2111659914 revert phpunit version 2021-02-22 08:16:46 +01:00
troosan
c28cbd7f08 Merge branch 'develop' of https://github.com/PHPOffice/PHPWord into
develop_v1.0

# Conflicts:
#	.travis.yml
#	composer.json
2021-02-21 23:02:55 +01:00
DE TROOSTEMBERGH Antoine
087628de5f update to phpunit 7.5 2019-12-14 22:23:57 +01:00
DE TROOSTEMBERGH Antoine
6d501332f3 update 7.4 in travis build 2019-12-14 22:23:36 +01:00
DE TROOSTEMBERGH Antoine
bf52f2d058 php 7.4 not yet available 2019-12-09 22:39:01 +01:00
DE TROOSTEMBERGH Antoine
711fcdeef7 still allow php 7.4 to fail because of dompdf 2019-12-09 21:38:04 +01:00
DE TROOSTEMBERGH Antoine
590a8b7ef2 build with php nightly 2019-12-09 21:14:37 +01:00
DE TROOSTEMBERGH Antoine
9914f3d295 Merge branch 'develop' into develop_v1.0 2019-12-08 21:12:22 +01:00
troosan
847520f380 Merge branch 'master' into develop_v1.0
Conflicts:
	.travis.yml
	composer.json
2019-10-01 23:55:29 +02:00
troosan
b54f39169e
Merge pull request #1545 from troosan/stop_building_for_php5.3
Update minimum req, stop running travis builds for php 5.3, 5.4, 5.5 and 7.0
2019-01-02 14:25:06 +01:00
troosan
8d92409bfe
Merge pull request #1032 from kaystrobach/patch-1
[BUGFIX] allow to load unclean html without exception
2019-01-02 14:23:56 +01:00
troosan
06a92710f6
remove whitespaces 2019-01-02 14:06:32 +01:00
troosan
5bc9250ccc
Fix unit tests 2019-01-02 09:28:51 +01:00
troosan
2a8a32e704 add alias for 1.0-dev branch 2019-01-02 09:06:10 +01:00
troosan
2968370bd1 update dependencies to minimum php 5.6 dependencies 2018-12-31 16:18:54 +01:00
troosan
6e00210f9a stop building for 5.3, 5.4, 5.5 and 7.0 2018-12-30 15:11:01 +01:00
troosan
b54200e5d8
Merge branch 'develop' into patch-1 2018-12-03 01:07:08 +01:00
Kay Strobach
33f1619d0f [BUGFIX] allow to load unclean html without exception
fixes #754
2017-03-29 10:08:11 +02:00
6 changed files with 81 additions and 14 deletions

1
.gitattributes vendored
View File

@ -10,6 +10,7 @@
# git files # git files
/.gitignore export-ignore /.gitignore export-ignore
/.gitattributes export-ignore /.gitattributes export-ignore
/.github export-ignore
# project directories # project directories
/build export-ignore /build export-ignore

64
.travis.yml Normal file
View File

@ -0,0 +1,64 @@
language: php
dist: xenial
php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly
matrix:
include:
- php: 7.2
env: COVERAGE=1
- php: nightly
env: DEPENDENCIES="--ignore-platform-reqs"
exclude:
- php: 7.2
- php: nightly
allow_failures:
- php: 7.4 #needs an update on dompdf
- php: nightly
cache:
directories:
- $HOME/.composer/cache
- .php-cs.cache
env:
global:
- secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4="
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:
## 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
- 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
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
## PHP-CS-Fixer
- if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
## PHP Mess Detector
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
## PHPUnit
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi)
## PHPDocumentor
##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
after_success:
## Coveralls
- if [ -n "$COVERAGE" ]; then travis_retry php vendor/bin/php-coveralls -v ; fi

View File

@ -58,25 +58,21 @@
"fix": "Fixes issues found by PHP-CS" "fix": "Fixes issues found by PHP-CS"
}, },
"require": { "require": {
"php": "^5.3.3 || ^7.0 || ^8.0", "php": "^7.1 || ^8",
"ext-xml": "*", "ext-xml": "*",
"laminas/laminas-escaper": "^2.2" "laminas/laminas-escaper": "^2.2"
}, },
"require-dev": { "require-dev": {
"ext-zip": "*", "ext-zip": "*",
"ext-gd": "*", "ext-gd": "*",
"phpunit/phpunit": "^4.8.36 || ^7.0", "phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^2.9 || ^3.5", "squizlabs/php_codesniffer": "^3.5",
"friendsofphp/php-cs-fixer": "^2.2", "friendsofphp/php-cs-fixer": "^2.14",
"phpmd/phpmd": "2.*", "phpmd/phpmd": "2.*",
"phploc/phploc": "2.* || 3.* || 4.* || 5.* || 6.* || 7.*",
"dompdf/dompdf":"0.8.* || 1.0.*", "dompdf/dompdf":"0.8.* || 1.0.*",
"tecnickcom/tcpdf": "6.*", "tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.7.4 || 6.* || 7.* || 8.*", "mpdf/mpdf": "8.*",
"php-coveralls/php-coveralls": "1.1.0 || ^2.0" "php-coveralls/php-coveralls": "^2.0"
},
"replace": {
"laminas/laminas-zendframework-bridge": "*"
}, },
"suggest": { "suggest": {
"ext-zip": "Allows writing OOXML and ODF", "ext-zip": "Allows writing OOXML and ODF",
@ -92,7 +88,8 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-develop": "0.18-dev" "dev-develop": "0.19-dev",
"develop_v1.0": "1.0-dev"
} }
} }
} }

View File

@ -30,6 +30,6 @@
<property name="minimum" value="30" /> <property name="minimum" value="30" />
</properties> </properties>
</rule> </rule>
<rule ref="rulesets/unusedcode.xml" /> <!--rule ref="rulesets/unusedcode.xml" /-->
<rule ref="rulesets/controversial.xml" /> <rule ref="rulesets/controversial.xml" />
</ruleset> </ruleset>

View File

@ -1,4 +1,6 @@
<phpunit backupGlobals="false" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false" backupStaticAttributes="false"
bootstrap="./tests/bootstrap.php" bootstrap="./tests/bootstrap.php"
colors="true" colors="true"

View File

@ -71,13 +71,16 @@ class Html
$html = '<body>' . $html . '</body>'; $html = '<body>' . $html . '</body>';
} }
//need to remove whitespaces between tags, as loadHTML seems to take those into account
$html = preg_replace('/(\>)\s*(\<)/m', '$1$2', $html);
// Load DOM // Load DOM
if (\PHP_VERSION_ID < 80000) { if (\PHP_VERSION_ID < 80000) {
$orignalLibEntityLoader = libxml_disable_entity_loader(true); $orignalLibEntityLoader = libxml_disable_entity_loader(true);
} }
$dom = new \DOMDocument(); $dom = new \DOMDocument();
$dom->preserveWhiteSpace = $preserveWhiteSpace; $dom->preserveWhiteSpace = $preserveWhiteSpace;
$dom->loadXML($html); $dom->loadHTML($html, LIBXML_NOWARNING);
self::$xpath = new \DOMXPath($dom); self::$xpath = new \DOMXPath($dom);
$node = $dom->getElementsByTagName('body'); $node = $dom->getElementsByTagName('body');