Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CHANGELOG
=========

1.15.0
1.15.0 (2026-11-17)
-------------------

* The pure PHP reader now rejects non-string map keys with
Expand Down Expand Up @@ -34,6 +34,12 @@ CHANGELOG
cannot throw.
* `MaxMind\Db\Reader\Decoder::decode()` and `MaxMind\Db\Reader\Util::read()`
declare their exceptions.
* The bundled libmaxminddb used by `--with-maxminddb-bundled` builds of the
extension is now 1.14.1. This fixes a build failure with `-Werror` on
platforms where `ssize_t` is 32 bits, such as i686.
* The classes in the pure PHP reader are now marked `@final`. They will be
`final` in the next major version. Static analyzers such as PHPStan report
a class that extends them.
* On 64-bit Windows, the extension returned `uint32` and `uint64` values
from 2^31 to `PHP_INT_MAX` as strings. It now returns them as integers.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You should now have the file `composer.phar` in your project directory.
Run in your project root:

```
php composer.phar require maxmind-db/reader:^1.14.0
php composer.phar require maxmind-db/reader:^1.15.0
```

You should now have the files `composer.json` and `composer.lock` as well as
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"maxmind-db/reader-ext": "C extension for significantly faster IP lookups (install via PIE: pie install maxmind-db/reader-ext)"
},
"conflict": {
"ext-maxminddb": "<1.14.0 || >=2.0.0"
"ext-maxminddb": "<1.15.0 || >=2.0.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.*",
Expand Down
8 changes: 2 additions & 6 deletions dev-bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ if ! gh workflow view release.yml --repo maxmind/MaxMind-DB-Reader-php-ext &>/de
fi

check_command perl
if ! perl -MHTML::Entities -e 1; then
echo "Error: Cannot load HTML::Entities. Install the Perl HTML::Parser distribution before releasing."
exit 1
fi
check_command php
check_command phpize
check_command pecl
Expand Down Expand Up @@ -168,8 +164,8 @@ export RELEASE_VERSION="$version" RELEASE_DATE="$date" RELEASE_NOTES="$notes"
subst composer.json 's/(?<="ext-maxminddb": "<)[^ ,|"]+/$ENV{RELEASE_VERSION}/'
subst package.xml 's/(?<=<(?:api)>)\d+\.\d+\.\d+(?=<)/$ENV{RELEASE_VERSION}/'
subst package.xml 's/(?<=<(?:release)>)\d+\.\d+\.\d+(?=<)/$ENV{RELEASE_VERSION}/'
# Limit escaping to XML text characters to avoid HTML-only named entities.
subst package.xml 's{(?<=<notes>).*(?=</notes>)}{encode_entities($ENV{RELEASE_NOTES}, "<>&")}sme' -0777 -MHTML::Entities
# Escape only the XML text characters, so no HTML-only named entities appear.
subst package.xml 's{(?<=<notes>).*(?=</notes>)}{(my $t = $ENV{RELEASE_NOTES}) =~ s/&/&amp;/g; $t =~ s/</&lt;/g; $t =~ s/>/&gt;/g; $t}sme' -0777
subst package.xml 's/(?<=<date>)\d{4}-\d{2}-\d{2}(?=<)/$ENV{RELEASE_DATE}/'
}

Expand Down
2 changes: 1 addition & 1 deletion ext/bundled-include/maxminddb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* every build, so a stale value here fails CI rather than shipping.
*/
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "1.14.0"
#define PACKAGE_VERSION "1.14.1"
#endif

#endif /* MAXMINDDB_CONFIG_H */
2 changes: 1 addition & 1 deletion ext/php_maxminddb.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#ifndef PHP_MAXMINDDB_H
#define PHP_MAXMINDDB_H 1
#define PHP_MAXMINDDB_VERSION "1.14.0"
#define PHP_MAXMINDDB_VERSION "1.15.0"
#define PHP_MAXMINDDB_EXTNAME "maxminddb"

extern zend_module_entry maxminddb_module_entry;
Expand Down
83 changes: 40 additions & 43 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,54 @@
<email>goschwald@maxmind.com</email>
<active>yes</active>
</lead>
<date>2026-09-10</date>
<date>2026-11-17</date>
<version>
<release>1.14.0</release>
<api>1.14.0</api>
<release>1.15.0</release>
<api>1.15.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="https://github.com/maxmind/MaxMind-DB-Reader-php/blob/main/LICENSE">Apache License 2.0</license>
<notes>* Bounded the resources that the pure PHP decoder spends on a single lookup. A
crafted database could nest data-section pointers to shared targets so that
decoding one record cost exponential time and memory, or point many times at
one large value so that the decoder copied far more data than the file holds.
The decoder now follows the Reader Resource Limits section of the MaxMind DB
specification. Each lookup is limited to 65,536 values, 512 levels of
nesting, and 2 MiB of string and bytes payload.
* Exceeding a limit throws an `InvalidDatabaseException`.
* Opening a database whose metadata exceeds a limit throws the same
exception.
* A scalar that declares more than 16 bytes, the width of the widest
fixed-width type, is rejected as invalid data.
<notes>* The pure PHP reader now rejects non-string map keys with
`InvalidDatabaseException` instead of a `TypeError`, a warning, or an
implicit type conversion.
* The pure PHP reader now rejects malformed metadata with
`InvalidDatabaseException` instead of a `TypeError`, a warning, or an
implicit type conversion. Missing optional `languages` and `description`
fields default to empty arrays.
* Missing gmp/bcmath support and offsets that exceed the platform limit now
throw `MaxMind\Db\Reader\UnsupportedPlatformException`. It extends
`RuntimeException`, so existing catches continue to work.
* The pure PHP reader also throws `UnsupportedPlatformException` when the
metadata node count or the start of the data section exceeds the platform's
integer limit. These cases no longer produce `InvalidDatabaseException` or
overflow into a `TypeError`.
* `phpinfo()` and `php --ri maxminddb` now show whether the extension was built
with the bundled libmaxminddb or links a system library. The
`libmaxminddb library version` row reads, for example, `1.14.0 (bundled)` or
`1.9.1 (system)`. Pull request by Remi Collet. GitHub #289.
* The PHPDoc of the pure PHP reader now lists the exceptions that its methods
can throw:
* The `MaxMind\Db\Reader` constructor, `get()`, and `getWithPrefixLen()`
declare `UnsupportedPlatformException`. The reader throws it when an
integer needs gmp or bcmath and neither is installed, or a data offset
exceeds the platform limit.
* The constructor declares `UnexpectedValueException`.
* `close()` declares `BadMethodCallException` in place of `Exception`.
`metadata()` no longer declares `InvalidArgumentException`, which it
cannot throw.
* `MaxMind\Db\Reader\Decoder::decode()` and `MaxMind\Db\Reader\Util::read()`
declare their exceptions.
* The bundled libmaxminddb used by `--with-maxminddb-bundled` builds of the
extension now applies the same decoder limits. The extension throws an
`InvalidDatabaseException` when a lookup exceeds them.
* The pure PHP reader is about 40% faster on City lookups. It no longer seeks
before a read that continues where the last one ended, and it checks read
lengths with `strlen()` instead of `ftell()`.
* The Windows build configuration now accepts either `libmaxminddb.lib` or
`maxminddb.lib` when building the extension. The `lib` prefix was removed
in libmaxminddb 1.6.0, but the libmaxminddb that PHP publishes for Windows
builds is still 1.5.0, which uses the prefixed name. Pull request by
Jean-Baptiste Nahan. GitHub #231.
* Replaced `XtOffsetOf()` with `offsetof()`. The `XtOffsetOf()` alias has
been removed in PHP 8.6. Pull request by Remi Collet. GitHub #252.
* The extension can now be built from a bundled copy of libmaxminddb, on
both Unix-like systems and Windows, by passing `--with-maxminddb-bundled`
to `configure` (or to `configure.bat` on Windows). This produces an
extension that does not depend on a system libmaxminddb, which is a
prerequisite for distributing precompiled builds; on Windows it also
replaces the 1.5.0 import library that PHP publishes for Windows builds.
The default is unchanged: without the flag, the extension links against a
system libmaxminddb as before. GitHub #265.
* The `conflict` constraint on `ext-maxminddb` in `composer.json` is again
updated when a release is cut. The substitution that maintains it stopped
matching in April 2024, when the constraint's separator changed from a comma
to `||`, so the constraint has read `&lt;1.11.1` through four releases. Users of
the C extension should note the effect of reviving it: `ext-maxminddb` is a
Composer platform package, so this release conflicts with an older compiled
extension and `composer update` will require upgrading the two together.
GitHub #266.</notes>
extension is now 1.14.1. This fixes a build failure with `-Werror` on
platforms where `ssize_t` is 32 bits, such as i686.
* The classes in the pure PHP reader are now marked `@final`. They will be
`final` in the next major version. Static analyzers such as PHPStan report
a class that extends them.
* On 64-bit Windows, the extension returned `uint32` and `uint64` values
from 2^31 to `PHP_INT_MAX` as strings. It now returns them as integers.</notes>
<contents>
<dir name="/">
<file role="doc" name="LICENSE"/>
Expand Down
2 changes: 2 additions & 0 deletions src/MaxMind/Db/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
* The declared exceptions describe the pure PHP reader. The C extension may
* differ.
*
* @final
*/
class Reader
{
Expand Down
3 changes: 3 additions & 0 deletions src/MaxMind/Db/Reader/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

// @codingStandardsIgnoreLine

/**
* @final
*/
class Decoder
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/MaxMind/Db/Reader/InvalidDatabaseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* This class should be thrown when unexpected data is found in the database.
*
* @final
*/
// phpcs:disable
class InvalidDatabaseException extends \Exception {}
2 changes: 2 additions & 0 deletions src/MaxMind/Db/Reader/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* This class provides the metadata for the MaxMind DB file.
*
* @final
*/
class Metadata
{
Expand Down
2 changes: 2 additions & 0 deletions src/MaxMind/Db/Reader/UnsupportedPlatformException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* The platform cannot decode a database value or offset.
*
* @final
*/
// phpcs:ignore PSR2.Classes.ClassDeclaration, Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore
class UnsupportedPlatformException extends \RuntimeException {}
3 changes: 3 additions & 0 deletions src/MaxMind/Db/Reader/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace MaxMind\Db\Reader;

/**
* @final
*/
class Util
{
/**
Expand Down
Loading