Skip to content

Commit 281a375

Browse files
jakejackson1claude
andauthored
Add PHP 8.6 support (#160)
Allow ~8.6.0 in composer.json and add 8.6 to the PHPUnit matrix. PHP 8.6 no longer includes a call's arguments in warning messages ("DOMDocument::save(): Failed to open stream" instead of "DOMDocument::save(./test/no-writing.xml): ..."), so testFailWriteXMLReportsWarning now accepts either form. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2 parents add0705 + ff15b2a commit 281a375

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎.github/workflows/unit-testing.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
88
strategy:
99
matrix:
10-
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
10+
php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6' ]
1111
include:
1212
# libxml2 2.14+ (ubuntu-26.04 onwards) parses HTML as HTML5, which skips the tests for
1313
# libxml's older HTML parser, so the coverage job stays on a runner that still has it.

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ QueryPath Changelog
33

44
# Unreleased changes
55

6+
- Add support for PHP 8.6
67
- On PHP 8.0 and later, `filterLambda()` and `eachLambda()` now throw a `QueryPath\Exception` that names their replacements, `filterCallback()` and `each()`, instead of an `Error` about the undefined `create_function()` (issue #81). They still work on PHP 7.1–7.4 and will be removed in 5.0
78
- **Behaviour change.** Fix the jQuery positional pseudo-classes (`:eq()`, `:first`, `:last`, `:lt()`, `:gt()`, `:odd`, `:even`, and the `:nth()` alias of `:eq()`), which indexed an element's siblings instead of the matched set (issue #66). They are now applied, zero-indexed and in document order, to the set the selector matched, as in jQuery. Most visibly, `:eq(0)` now matches the first result instead of never matching. `:lt()`, `:gt()`, `:eq()` and `:nth()` are zero-indexed where they were previously one-indexed, `:odd`/`:even` now index the matched set rather than sibling position, and a negative index counts back from the end of the set (`:eq(-1)` is the last match). The CSS structural pseudo-classes (`:nth-child()`, `:nth-of-type()`, `:first-child`, `:last-child`, ...) are unchanged and still count siblings, one-indexed
89
- Make `QueryPath\CSS\QueryPathEventHandler`, the legacy selector engine, agree with `QueryPath\CSS\DOMTraverser` on the positional pseudo-classes, except in the argument of `:not()`

‎composer.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gravitypdf/querypath",
33
"type": "library",
4-
"description": "PHP library for HTML(5)/XML querying (CSS 4 or XPath) and processing (like jQuery) with PHP 7.1 to 8.5 support",
4+
"description": "PHP library for HTML(5)/XML querying (CSS 4 or XPath) and processing (like jQuery) with PHP 7.1 to 8.6 support",
55
"homepage": "https://github.com/gravitypdf/querypath",
66
"license": "MIT",
77
"keywords": [
@@ -23,7 +23,7 @@
2323
}
2424
],
2525
"require": {
26-
"php": "^7.1 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
26+
"php": "^7.1 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0",
2727
"masterminds/html5": "^2.0",
2828
"ext-dom": "*",
2929
"ext-simplexml": "*"

‎tests/QueryPath/DOMQueryTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,8 @@ public function testFailWriteXML()
18851885
public function testFailWriteXMLReportsWarning()
18861886
{
18871887
$this->expectException(IOException::class);
1888-
$this->expectExceptionMessage('DOMDocument::save(./test/no-writing.xml)');
1888+
// PHP 8.6 dropped the call's arguments from warnings: "DOMDocument::save(): ...".
1889+
$this->expectExceptionMessageMatches('/DOMDocument::save\\((?:\\.\\/test\\/no-writing\\.xml)?\\): [Ff]ailed to open stream/');
18891890
$this->expectExceptionCode(E_WARNING);
18901891

18911892
qp()->writeXML('./test/no-writing.xml');

0 commit comments

Comments
 (0)