php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73416 Skip database availability test if the file isn't there
Submitted: 2016-10-30 00:47 UTC Modified: -
From: michael at orlitzky dot com Assigned:
Status: Open Package: geoip (PECL)
PHP Version: 7.0.12 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michael at orlitzky dot com
New email:
PHP Version: OS:

 

 [2016-10-30 00:47 UTC] michael at orlitzky dot com
Description:
------------
On Gentoo, when you install pecl-geoip, it pulls in the geoip library as a dependency. However, the geoip library doesn't install any databases for you -- you're supposed to run a script (like in a cron job) to download the latest databases. This presents a problem when you're installing pecl-geoip, because the databases won't be there immediately. Thus the first test tests/001.phpt can fail.

To make the tests pass predictably, we can disable that test entirely. But a better solution would be to skip that test if the database file doesn't exist. This can be accomplished with the following change to 001.phpt:

-<?php if (!extension_loaded("geoip")) print "skip"; ?>
+<?php
+if (!extension_loaded("geoip")) print "skip";
+if (!file_exists(geoip_db_filename(GEOIP_COUNTRY_EDITION))) print "skip";
+?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC