From 5b38e187d96053a198ac1fdef9fbebccbf7e4b19 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 27 Sep 2022 12:19:41 +0100 Subject: [PATCH] MDL-75477 libraries: upgrade to version 1.11.0 of MaxMind. --- lib/maxmind/MaxMind/CHANGELOG.md | 8 ++++++++ lib/maxmind/MaxMind/Db/Reader/Decoder.php | 15 ++++----------- lib/maxmind/MaxMind/composer.json | 2 +- lib/thirdpartylibs.xml | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/maxmind/MaxMind/CHANGELOG.md b/lib/maxmind/MaxMind/CHANGELOG.md index 7b74978773c..4c89f0cc982 100644 --- a/lib/maxmind/MaxMind/CHANGELOG.md +++ b/lib/maxmind/MaxMind/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +1.11.0 +------------------- + +* Replace runtime define of a constant to facilitate opcache preloading. + Reported by vedadkajtaz. GitHub #134. +* Resolve minor issue found by the Clang static analyzer in the C + extension. + 1.10.1 (2021-04-14) ------------------- diff --git a/lib/maxmind/MaxMind/Db/Reader/Decoder.php b/lib/maxmind/MaxMind/Db/Reader/Decoder.php index 4b00456413f..babaed878c7 100644 --- a/lib/maxmind/MaxMind/Db/Reader/Decoder.php +++ b/lib/maxmind/MaxMind/Db/Reader/Decoder.php @@ -7,13 +7,6 @@ namespace MaxMind\Db\Reader; // @codingStandardsIgnoreLine use RuntimeException; -/* - * @ignore - * - * We subtract 1 from the log to protect against precision loss. - */ -\define(__NAMESPACE__ . '\_MM_MAX_INT_BYTES', (int) ((log(\PHP_INT_MAX, 2) - 1) / 8)); - class Decoder { /** @@ -316,11 +309,11 @@ class Decoder $integer = 0; - // PHP integers are signed. _MM_MAX_INT_BYTES is the number of + // PHP integers are signed. PHP_INT_SIZE - 1 is the number of // complete bytes that can be converted to an integer. However, // we can convert another byte if the leading bit is zero. - $useRealInts = $byteLength <= _MM_MAX_INT_BYTES - || ($byteLength === _MM_MAX_INT_BYTES + 1 && (\ord($bytes[0]) & 0x80) === 0); + $useRealInts = $byteLength <= \PHP_INT_SIZE - 1 + || ($byteLength === \PHP_INT_SIZE && (\ord($bytes[0]) & 0x80) === 0); for ($i = 0; $i < $byteLength; ++$i) { $part = \ord($bytes[$i]); @@ -344,7 +337,7 @@ class Decoder private function sizeFromCtrlByte(int $ctrlByte, int $offset): array { - $size = $ctrlByte & 0x1f; + $size = $ctrlByte & 0x1F; if ($size < 29) { return [$size, $offset]; diff --git a/lib/maxmind/MaxMind/composer.json b/lib/maxmind/MaxMind/composer.json index 8d9f9d50613..26d48730125 100644 --- a/lib/maxmind/MaxMind/composer.json +++ b/lib/maxmind/MaxMind/composer.json @@ -24,7 +24,7 @@ "ext-maxminddb": "<1.10.1,>=2.0.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "*", + "friendsofphp/php-cs-fixer": "3.*", "phpunit/phpunit": ">=8.0.0,<10.0.0", "php-coveralls/php-coveralls": "^2.1", "phpunit/phpcov": ">=6.0.0", diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 47118aed1ce..3891920e4af 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -413,7 +413,7 @@ All rights reserved. maxmind/MaxMind MaxMind DB Reader API PHP API for reading MaxMind DB files. - 1.10.1 + 1.11.0 Apache 2.0 https://github.com/maxmind/MaxMind-DB-Reader-php/