Skip to content

Commit 8bed735

Browse files
committed
fixes and enhancements
1 parent dfcbf87 commit 8bed735

4 files changed

Lines changed: 1694 additions & 511 deletions

File tree

ChangeLog

Lines changed: 87 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,114 @@
11
Revision History for PHP Module for IP2Location
22

3+
7.2.0 Wed Jul 29 14:07:23 2015
4+
**Special thanks to Mariano (mariano.perez.rodriguez [at] gmail.com) for working on this release**
5+
6+
* Removals:
7+
8+
- Removed IP2LocationRecord class, it served little purpose and an array response would be much more flexible (see below).
9+
- Removed everything to do with endianness (there was some leftover code and constants).
10+
- Removed IP version constants, they were unused.
11+
- Removed the SHM_KEY constant in favor of a dynamic shared memory key calculation.
12+
- Removed "$database" property in favor of a set of IP-version-directed metadata properties.
13+
- Removed useless caching of lookup results in "$result" property.
14+
- Removed closing PHP tag.
15+
16+
17+
* Fixes:
18+
19+
- Fixed possible overruns of the binary file by only reading as much as needed and not more.
20+
- Fixed IPv6 lookup (it was never going to work: you were trying to compare a number to a BCMath string).
21+
- Fixed binary search midpoint calculation.
22+
- Fixed shared memory permissions so as not to leak information to other users / groups.
23+
- Gave a unique number to each numeric class constant to prevent accidental misuse.
24+
25+
26+
* Enhancements:
27+
28+
- Automatically determine float size (this is not optimal, but as good as we're going to get).
29+
- Removed "magic numbers" as much as possible and factored them out to class constants.
30+
- IP address, version, and number are now selectable fields.
31+
- The "$columns" array has been made static, no need for a copy for each possible instance.
32+
- The "$columns" array has been reindexed with integer keys to avoid double lookup during binary search.
33+
- The "$columns" array has had its entries multiplied by 4, in order to avoid repeatedly multiplying by 4 every time its values were going to be used.
34+
- The memory buffer has been made static (this way, if two instances are created they can share the buffer instead of using up twice as much memory for the same data).
35+
- Internal variable handling has been simplified with a single "$resource" property whose meaning changes as the caching method changes.
36+
- The class constructor will now accept an empty filename, in this case, it will look for the most general database BIN in the file's directory and load that.
37+
- Quadwords and IPv6 addresses are now parsed by a simple and highly portable routine.
38+
- Low level reading abstracting away from the caching method has been implemented as a private method (this simplifies the low-level reading functions tremendously).
39+
- Strings are now read by providing just a pointer to the word value describing its start: the length is automatically retrieved and only the necessary bytes are read (preventing overrun errors).
40+
- Low level read routines have been greatly simplified.
41+
- High level read routines have been added, specifically, those providing related fields have been grouped together.
42+
- Binary search has been decoupled from field lookup (cleaning up the implementation).
43+
- Binary search will now work correctly with IPv6 addresses.
44+
45+
46+
* Additions:
47+
48+
- Added "FIELD_NOT_KNOWN" to manage unknown field requests.
49+
- Added "multiple" fields (eg. "COORDINATES" in order to get latitude and longitude at the same time).
50+
- Added the "Ip2Location" namespace, and changed the class' name to "Database", so we now have "Ip2Location\Database", accordingly, the filename has been changed to "Database.php", this should be put in a directory named "Ip2Location" in order to comply with PSR-0 / PSR-4.
51+
- A destructor has been added to properly detach from shared memory / close opened files.
52+
- A static method has been added to tear down the shared memory segments created by the class (otherwise, it's a pain to delete them).
53+
- Added a "getDate()" method, this will provide the database's compilation date as YYYY-MM-DD.
54+
- Added a "getType()" method, returning the database type (1--24).
55+
- Added a "getFields()" method, returning the supported fields.
56+
- Rewrote the "lookup()" method: it now accepts either a field name (which could be a MULTIPLE field), or an array of field names, and it will return either a single field value (if a single field given), or an array (possibly named) of values found.
57+
58+
359
7.1.0 Thu Jul 23 15:15:36 2015
4-
Removed dependency php_gmp
5-
Fixed shared memory issues
6-
Fixed binary read functions
7-
Restructure lookup algorithm
60+
Removed dependency php_gmp
61+
Fixed shared memory issues
62+
Fixed binary read functions
63+
Restructure lookup algorithm
864

965
7.0.0 Wed Aug 13 12:41:16 2014
10-
Added support to IP2Location IPv6 DB2-DB24
66+
Added support to IP2Location IPv6 DB2-DB24
1167

1268
6.00 Wed May 08 08:43:22 2013
13-
Added support to IP2Location DB21-24
14-
Added new lookup method MEMORY_CACHE, and SHARED_MEMORY
15-
New structure to use IP2Location class
69+
Added support to IP2Location DB21-24
70+
Added new lookup method MEMORY_CACHE, and SHARED_MEMORY
71+
New structure to use IP2Location class
1672

1773
5.00 Fri Jan 14 09:59:15 2011
18-
Added support to IP2Location DB19-20
19-
Added new public function "getMcc"
20-
Added new public function "getMnc"
21-
Added new public function "getMobileBrand"
74+
Added support to IP2Location DB19-20
75+
Added new public function "getMcc"
76+
Added new public function "getMnc"
77+
Added new public function "getMobileBrand"
2278

2379
4.00 Thu Oct 01 13:09:43 2009
24-
Merged all functions into one class
25-
Changed functions name
80+
Merged all functions into one class
81+
Changed functions name
2682

2783
3.00 Wed Aug 13 10:00:00 2008
28-
Added support to IP2Location DB15-18
29-
Added new public function "IP2Location_get_idd_code"
30-
Added new public function "IP2Location_get_area_code"
31-
Added new public function "IP2Location_get_weather_code"
32-
Added new public function "IP2Location_get_weather_name"
84+
Added support to IP2Location DB15-18
85+
Added new public function "IP2Location_get_idd_code"
86+
Added new public function "IP2Location_get_area_code"
87+
Added new public function "IP2Location_get_weather_code"
88+
Added new public function "IP2Location_get_weather_name"
3389

3490
2.20 Tue Sep 25 00:00:00 2007
35-
Support PHP4 and PHP5
91+
Support PHP4 and PHP5
3692

3793
2.10 Fri Oct 20 00:00:00 2006
38-
Support IP2Location DB11, DB12, DB13 & DB14
94+
Support IP2Location DB11, DB12, DB13 & DB14
3995

4096
2.00 Fri Oct 20 00:00:00 2006
41-
Support IP2Location IPv6
97+
Support IP2Location IPv6
4298

4399
1.30 Wed Nov 23 16:59:58 2005
44-
Minor Bug Fix
100+
Minor Bug Fix
45101

46102
1.20 Thu Nov 17 16:59:58 2005
47-
Minor Bug Fix
103+
Minor Bug Fix
48104

49105
1.10 Thu Oct 27 16:59:58 2005
50-
Support Big Endian Machines
106+
Support Big Endian Machines
51107

52108
1.00 Thu Oct 13 16:59:58 2005
53-
First release for PHP 4.0 and above
54-
Added new public function "IP2Location_open"
55-
Added new public function "IP2Location_close"
56-
Added new public function "IP2Location_get_all"
57-
Added new public structure "IP2Location"
58-
Added new public structure "IP2LocationRecord"
109+
First release for PHP 4.0 and above
110+
Added new public function "IP2Location_open"
111+
Added new public function "IP2Location_close"
112+
Added new public function "IP2Location_get_all"
113+
Added new public structure "IP2Location"
114+
Added new public structure "IP2LocationRecord"

0 commit comments

Comments
 (0)