Guidelines
Description of the bug
QueryPath::VERSION and QueryPath::VERSION_MAJOR still report 3.2.2 and 3. The installed release is 4.2.0, so both constants have been wrong for the whole 4.x line.
src/QueryPath.php:54-65:
public const VERSION = '3.2.2';
...
public const VERSION_MAJOR = 3;
These are public API, so anyone using them for a compatibility check gets the wrong answer — and VERSION_MAJOR in particular reads like it exists precisely for that purpose. A check such as QueryPath::VERSION_MAJOR >= 4 fails on a 4.x install.
Suggested resolution
Either keep them accurate as part of the release process, or — probably better — deprecate them and point users at Composer's runtime API, which cannot drift:
\Composer\InstalledVersions::getPrettyVersion('gravitypdf/querypath');
A hand-maintained version constant in a library that does not carry a version key in composer.json has no mechanism keeping it honest, which is how it ended up two majors behind.
If they are kept, updating them is technically a behaviour change for anyone currently branching on the wrong value, so 5.0 may be the tidier place to remove them.
I have documented the constants as unreliable in the meantime.
QueryPath version
4.2.0 (also reproduces on main at bed5d2c)
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
PHP 8.3.16 CLI (macOS, Homebrew). Not version-specific.
Minimal reproducible PHP+HTML snippet to replicate bug
<?php
require __DIR__ . '/vendor/autoload.php';
var_dump(\QueryPath\QueryPath::VERSION); // string(5) "3.2.2"
var_dump(\QueryPath\QueryPath::VERSION_MAJOR); // int(3)
// Reports the actually-installed version — "4.2.0" for a tagged install,
// "dev-main" when working from a clone of this repository.
var_dump(\Composer\InstalledVersions::getPrettyVersion('gravitypdf/querypath'));
Guidelines
Description of the bug
QueryPath::VERSIONandQueryPath::VERSION_MAJORstill report3.2.2and3. The installed release is 4.2.0, so both constants have been wrong for the whole 4.x line.src/QueryPath.php:54-65:These are public API, so anyone using them for a compatibility check gets the wrong answer — and
VERSION_MAJORin particular reads like it exists precisely for that purpose. A check such asQueryPath::VERSION_MAJOR >= 4fails on a 4.x install.Suggested resolution
Either keep them accurate as part of the release process, or — probably better — deprecate them and point users at Composer's runtime API, which cannot drift:
A hand-maintained version constant in a library that does not carry a
versionkey incomposer.jsonhas no mechanism keeping it honest, which is how it ended up two majors behind.If they are kept, updating them is technically a behaviour change for anyone currently branching on the wrong value, so 5.0 may be the tidier place to remove them.
I have documented the constants as unreliable in the meantime.
QueryPath version
4.2.0 (also reproduces on
mainat bed5d2c)PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
PHP 8.3.16 CLI (macOS, Homebrew). Not version-specific.
Minimal reproducible PHP+HTML snippet to replicate bug