-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Validation Result: Confirmed Bug
Verdict: VALID_BUG | Confidence: HIGH | Severity: High
Source: https://wordpress.org/support/topic/bug-call-to-undefined-function-geolocationproviderwp_tempnam-2/
Summary
Confirmed. DbIpProvider::updateDatabase() calls wp_tempnam() without first loading wp-admin/includes/file.php. During WP-Cron execution, WordPress admin includes are not available, causing the fatal error.
Root Cause
Fault Location: src/Services/Geolocation/Provider/DbIpProvider.php:65
Mechanism: Missing require_once ABSPATH . 'wp-admin/includes/file.php' before calling wp_tempnam(). The MaxMind provider correctly includes this file; the DB-IP provider does not.
Causal Chain:
WP-Cron fires → wp_slimstat_update_geoip_database() → GeolocationService->updateDatabase() → DbIpProvider->updateDatabase() → wp_tempnam() called → function not defined in cron context → fatal error
Fix
Add at the top of DbIpProvider::updateDatabase():
if (!function_exists('wp_tempnam')) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}Code References
| File | Lines | Description |
|---|---|---|
src/Services/Geolocation/Provider/DbIpProvider.php |
65 | Missing admin include before wp_tempnam() |
src/Services/Geolocation/Provider/MaxmindGeoIPProvider.php |
91-96 | Correct pattern for comparison |
Reproduction
Preconditions: PHP 8.4, latest WordPress, WP Slimstat 7.4.1, geolocation provider set to dbip
- Install WP Slimstat 7.4.1 with dbip as the geolocation provider
- Trigger WP-Cron: visit
/wp-cron.php?doing_wp_cron - Check PHP error log
Expected: DB-IP database downloads successfully
Actual: Fatal error — Call to undefined function SlimStat\Services\Geolocation\Provider\wp_tempnam()
Validated via qa-issue-validate skill (jaan.to plugin)