From 814c6e47307392f4a9fa64d5b87f4856d301de14 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 10 Jun 2015 09:11:17 +0200 Subject: [PATCH 1/2] Restore compatibility with PHP 5.3 --- .travis.yml | 2 ++ composer.json | 2 +- phpunit.xml.dist | 2 +- src/Readability.php | 9 +++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 190b404..a5e141b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: php php: + - 5.3.3 + - 5.3 - 5.4 - 5.5 - 5.6 diff --git a/composer.json b/composer.json index 5a96b17..07cbe59 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "role": "Developer (original JS version)" }], "require": { - "php": ">=5.4", + "php": ">=5.3.3", "ext-tidy": ">=1.2" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e6a0903..6a5fee8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,6 +27,6 @@ - + diff --git a/src/Readability.php b/src/Readability.php index eabcca8..5b714a7 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -47,7 +47,6 @@ namespace Readability; */ class Readability { - public $version = '1.7.2-without-multi-page'; public $convertLinksToFootnotes = false; public $revertForcedParagraphElements = true; public $articleTitle; @@ -195,7 +194,13 @@ class Readability libxml_use_internal_errors(true); $this->dom = new \DOMDocument(); $this->dom->preserveWhiteSpace = false; - @$this->dom->loadHTML($html, LIBXML_NOBLANKS | LIBXML_COMPACT | LIBXML_NOERROR); + + if (PHP_VERSION_ID >= 50400) { + $this->dom->loadHTML($html, LIBXML_NOBLANKS | LIBXML_COMPACT | LIBXML_NOERROR); + } else { + $this->dom->loadHTML($html); + } + libxml_use_internal_errors(false); } From eecae93161caca02d10ea192e9b171ec42e506db Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 10 Jun 2015 09:29:11 +0200 Subject: [PATCH 2/2] Try hhvm instead of nightly HHVM nightly is no longer supported on Ubuntu Precise. See https://github.com/travis-ci/travis-ci/issues/3788 and https://github.com/facebook/hhvm/issues/5220 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a5e141b..01483ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,14 @@ php: - 5.5 - 5.6 - nightly - - hhvm-nightly + - hhvm # run build against nightly but allow them to fail matrix: fast_finish: true allow_failures: - php: nightly - - php: hhvm-nightly + - php: hhvm # faster builds on new travis setup not using sudo sudo: false