php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52855 Incorrect example provided for geoip-db-avail
Submitted: 2010-09-15 15:33 UTC Modified: 2010-09-16 09:09 UTC
From: james dot widdowson at tiscali dot co dot uk Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: 5.3.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
10 - 10 = ?
Subscribe to this entry?

 
 [2010-09-15 15:33 UTC] james dot widdowson at tiscali dot co dot uk
Description:
------------
The example provided on the following page is incorrect:
http://www.php.net/manual/en/function.geoip-db-avail.php

Example #1 A geoip_db_avail() example

This will output the current database version string. 

<?php

if (geoip_db_avail(GEOIP_COUNTRY_EDITION))
    print geoip_database_info(GEOIP_COUNTRY_EDITION);
?> 
The above example will output:

GEO-106FREE 20080801 Build 1 Copyright (c) 2006 MaxMind LLC All Rights Reserved

The incorrect function (geoip_database_info rather than geoip_db_avail)is being used in the print statement which means the output displayed is incorrect for the function being described. It should be a bool.

Expected result:
----------------
Example #1 A geoip_db_avail() example

This will output the current database version string. 

<?php

if (geoip_db_avail(GEOIP_COUNTRY_EDITION))
    print geoip_db_avail(GEOIP_COUNTRY_EDITION);
?> 
The above example will output:

True



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-16 09:09 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 [2010-09-16 09:09 UTC] aharvey@php.net
Actually, that looks correct to me: the intention of the example seems to be to demonstrate that you would use geoip_db_avail() before making any other calls that use the GeoIP database, such as geoip_database_info().

Closing won't fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 22:01:29 2024 UTC