-
Notifications
You must be signed in to change notification settings - Fork 83
Follow ups to bundled/system libmaxminddb reporting #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
382ad9d
845eb09
7052ab8
58f2bda
c151c7e
8ad6b04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,15 @@ | |
| #include "ext/standard/info.h" | ||
| #include <maxminddb.h> | ||
|
|
||
| /* Both build files define this as 1 or 0 on every path, so a missing | ||
| * definition is a build-file mistake, not a system build. Fail rather than | ||
| * report "system" for a bundled object. Unlike php-src's HAVE_GD_BUNDLED, | ||
| * which is absent in a system build, this must be tested with #if: #ifdef | ||
| * is true for the 0 too. */ | ||
| #ifndef HAVE_LIBMAXMINDDB_BUNDLED | ||
| #error "HAVE_LIBMAXMINDDB_BUNDLED must be defined by the build files" | ||
| #endif | ||
|
|
||
| #ifdef ZTS | ||
| #include <TSRM.h> | ||
| #endif | ||
|
|
@@ -792,18 +801,23 @@ PHP_MINIT_FUNCTION(maxminddb) { | |
| } | ||
|
|
||
| static PHP_MINFO_FUNCTION(maxminddb) { | ||
| #if HAVE_LIBMAXMINDDB_BUNDLED | ||
| const char *lib_source = "bundled"; | ||
| #else | ||
| const char *lib_source = "system"; | ||
| #endif | ||
| char *lib_version; | ||
|
|
||
| php_info_print_table_start(); | ||
|
|
||
| php_info_print_table_row(2, "MaxMind DB Reader", "enabled"); | ||
| php_info_print_table_row( | ||
| 2, "maxminddb extension version", PHP_MAXMINDDB_VERSION); | ||
| php_info_print_table_row( | ||
| 3, "libmaxminddb library version", MMDB_lib_version(), | ||
| #ifdef HAVE_LIBMAXMINDDB_BUNDLED | ||
| "(bundled)"); | ||
| #else | ||
| "(system)"); | ||
| #endif | ||
|
|
||
| spprintf(&lib_version, 0, "%s (%s)", MMDB_lib_version(), lib_source); | ||
| CHECK_ALLOCATED(lib_version); | ||
| php_info_print_table_row(2, "libmaxminddb library version", lib_version); | ||
|
Comment on lines
+817
to
+819
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed that nothing in CI calls If we add a check, the cheapest place is dev-bin/verify-extension.php. It already receives the expected libmaxminddb version, and every job that runs it is a bundled build, so it could capture Will doesn't want to bother with this right now, though. 🤖 Comment by Claude (Claude Code) on behalf of Will. |
||
| efree(lib_version); | ||
|
|
||
| php_info_print_table_end(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The guard sits after
#include <php.h>(line 20), not before it. Theconfig.hthat config.w32 leaves out is a different header. On Windows the macro reaches this file through php.h → zend_portability.h → zend_config.w32.h → main/config.w32.h → config.pickle.h, which the comment above theAC_DEFINEin config.w32 spells out.CI confirms it: the Windows bundled job in test-bundled.yml compiled and loaded the DLL on this PR, which it could not have done if this
#errorfired.🤖 Comment by Claude (Claude Code) on behalf of Will.