using length instead of count for php < 7.2 compatibility (#643)

pull/644/head 1.5.43
Maciej Kiejda 2022-10-11 17:01:37 +02:00 committed by GitHub
parent 198ebedc14
commit 78e9e45c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -219,11 +219,11 @@ set_error_handler(
$xpath = new DOMXpath($doc); $xpath = new DOMXpath($doc);
$xpath->registerNamespace('v20', 'http://pear.php.net/dtd/package-2.0'); $xpath->registerNamespace('v20', 'http://pear.php.net/dtd/package-2.0');
$xpath->registerNamespace('v21', 'http://pear.php.net/dtd/package-2.1'); $xpath->registerNamespace('v21', 'http://pear.php.net/dtd/package-2.1');
if ($xpath->query('/v20:package/v20:dependencies')->count() === 1) { if ($xpath->query('/v20:package/v20:dependencies')->length === 1) {
$ns = 'v20:'; $ns = 'v20:';
} elseif ($xpath->query('/v21:package/v21:dependencies')->count() === 1) { } elseif ($xpath->query('/v21:package/v21:dependencies')->length === 1) {
$ns = 'v21:'; $ns = 'v21:';
} elseif ($xpath->query('/package')->count() === 1) { } elseif ($xpath->query('/package')->length === 1) {
$ns = ''; $ns = '';
} else { } else {
fwrite(STDERR, "Unsupported namespace of the XML of package version details\n"); fwrite(STDERR, "Unsupported namespace of the XML of package version details\n");