Skip to content

fix compatibility with PHP 8.0.0RC1 #27

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/config.sub
/configure
/configure.in
/configure.ac
/config.status
/config.cache
/conftest
Expand Down
11 changes: 8 additions & 3 deletions geospatial.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
+----------------------------------------------------------------------+
| PHP Version 5/7 |
| PHP Version 5/7/8 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
| Copyright (c) 1997-2020 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
Expand Down Expand Up @@ -34,6 +34,11 @@
#include "Zend/zend_exceptions.h"
#include "ext/spl/spl_exceptions.h"

#ifndef TSRMLS_CC
#define TSRMLS_CC
#define TSRMLS_DC
#endif

/**
* The WGS84 elipsoid semi major axes
*/
Expand Down Expand Up @@ -492,7 +497,7 @@ geo_cartesian polar_to_cartesian(double latitude, double longitude, geo_ellipsoi
geo_lat_long cartesian_to_polar(double x, double y, double z, geo_ellipsoid eli)
{

double nu, lambda, h;
double nu = 0, lambda, h;
geo_lat_long polar;

/* aiming for 1m accuracy */
Expand Down
6 changes: 3 additions & 3 deletions tests/Greenwich.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ var_dump($polar);
echo round($diferenceWGS84, 8),PHP_EOL;
echo round($diferenceAiry, 8),PHP_EOL;
?>
--EXPECT--
--EXPECTF--
array(2) {
["type"]=>
string(5) "Point"
["coordinates"]=>
array(2) {
[0]=>
float(0.00013627354767069)
float(0.0001362735476706%s)
[1]=>
float(51.477400823311)
float(51.47740082331%s)
}
}
102.84185171
Expand Down
6 changes: 3 additions & 3 deletions tests/JodrellBank.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ $polar = transform_datum($from, GEO_WGS84, GEO_AIRY_1830);

var_dump($polar);
?>
--EXPECT--
--EXPECTF--
array(2) {
["type"]=>
string(5) "Point"
["coordinates"]=>
array(2) {
[0]=>
float(-2.3057171628534)
float(-2.305717162853%s)
[1]=>
float(53.235974015543)
float(53.23597401554%s)
}
}
6 changes: 3 additions & 3 deletions tests/OSGB36_to_WGS84.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ $polar = transform_datum($from, GEO_AIRY_1830, GEO_WGS84);
var_dump(decimal_to_dms($polar['coordinates'][1], 'latitude'));
var_dump(decimal_to_dms($polar['coordinates'][0] ,'longitude'));
?>
--EXPECT--
--EXPECTF--
array(4) {
["degrees"]=>
int(53)
["minutes"]=>
int(14)
["seconds"]=>
float(11.493372672732)
float(11.49337267273%s)
["direction"]=>
string(1) "N"
}
Expand All @@ -30,7 +30,7 @@ array(4) {
["minutes"]=>
int(18)
["seconds"]=>
float(30.817794659248)
float(30.81779465924%s)
["direction"]=>
string(1) "W"
}
6 changes: 3 additions & 3 deletions tests/decimal_to_dms.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ var_dump($dms);
$dms = decimal_to_dms(-1.034291666667, 'latitude');
var_dump($dms);
?>
--EXPECT--
--EXPECTF--
array(4) {
["degrees"]=>
int(1)
["minutes"]=>
int(2)
["seconds"]=>
float(3.4500000011994)
float(3.450000001199%s)
["direction"]=>
string(1) "W"
}
Expand All @@ -26,7 +26,7 @@ array(4) {
["minutes"]=>
int(2)
["seconds"]=>
float(3.4500000011994)
float(3.450000001199%s)
["direction"]=>
string(1) "S"
}
14 changes: 7 additions & 7 deletions tests/dms_to_decimal.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ var_dump($decimal);
$decimal = dms_to_decimal(74, 34, 31, 'W');
var_dump($decimal);
?>
--EXPECT--
float(-1.0342916666667)
float(-2.3071388888889)
float(-2.3071388888889)
float(-2.3071388888889)
float(-0.1025)
float(-74.575277777778)
--EXPECTF--
float(-1.034291666666%s)
float(-2.307138888888%s)
float(-2.307138888888%s)
float(-2.307138888888%s)
float(-0.102%s)
float(-74.57527777777%s)
20 changes: 10 additions & 10 deletions tests/fraction_along-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var_dump(fraction_along_gc_line($point1, $point2, 0.6));
var_dump(fraction_along_gc_line($point1, $point2, 0.8));
var_dump(fraction_along_gc_line($point1, $point2, 1));
?>
--EXPECT--
--EXPECTF--
array(2) {
["type"]=>
string(5) "Point"
Expand All @@ -30,9 +30,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(6.9998522347268)
float(6.999852234726%s)
[1]=>
float(10.023944943799)
float(10.02394494379%s)
}
}
array(2) {
Expand All @@ -41,9 +41,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(8.9999260791276)
float(8.999926079127%s)
[1]=>
float(10.035925156339)
float(10.03592515633%s)
}
}
array(2) {
Expand All @@ -52,9 +52,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(11.000073920872)
float(11.00007392087%s)
[1]=>
float(10.035925156339)
float(10.03592515633%s)
}
}
array(2) {
Expand All @@ -63,9 +63,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(13.000147765273)
float(13.00014776527%s)
[1]=>
float(10.023944943799)
float(10.02394494379%s)
}
}
array(2) {
Expand All @@ -74,7 +74,7 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(15)
float(1%s)
[1]=>
float(10)
}
Expand Down
6 changes: 3 additions & 3 deletions tests/fraction_along-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ $point2 = [ 'type' => 'Point', 'coordinates' => [ 3.2200, 55.9500 ] ];

var_dump(fraction_along_gc_line($point1, $point2, 0.5));
?>
--EXPECT--
--EXPECTF--
array(2) {
["type"]=>
string(5) "Point"
["coordinates"]=>
array(2) {
[0]=>
float(1.5809481271999)
float(1.580948127199%s)
[1]=>
float(53.743611334154)
float(53.74361133415%s)
}
}
38 changes: 19 additions & 19 deletions tests/geohash_decode.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var_dump(geohash_decode('u2edjnw17enr'));

var_dump(geohash_decode('zzzzzzzzzzzz'));
?>
--EXPECT--
--EXPECTF--
array(2) {
["type"]=>
string(5) "Point"
Expand Down Expand Up @@ -87,9 +87,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.02966308594)
float(171.029663085%s)
[1]=>
float(49.671936035156)
float(49.6719360351%s)
}
}
array(2) {
Expand All @@ -98,9 +98,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.02897644043)
float(171.028976440%s)
[1]=>
float(49.67399597168)
float(49.6739959716%s)
}
}
array(2) {
Expand All @@ -109,9 +109,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.0284614563)
float(171.028461456%s)
[1]=>
float(49.674081802368)
float(49.6740818023%s)
}
}
array(2) {
Expand All @@ -120,9 +120,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.02861166)
float(171.0286116%s)
[1]=>
float(49.674146175385)
float(49.67414617%s)
}
}
array(2) {
Expand All @@ -131,9 +131,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.02859556675)
float(171.0285955667%s)
[1]=>
float(49.674154222012)
float(49.67415422201%s)
}
}
array(2) {
Expand All @@ -142,9 +142,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.0285962373)
float(171.028596237%s)
[1]=>
float(49.674153551459)
float(49.67415355145%s)
}
}
array(2) {
Expand All @@ -153,9 +153,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(171.02859674022)
float(171.0285967402%s)
[1]=>
float(49.674154138193)
float(49.67415413819%s)
}
}
array(2) {
Expand Down Expand Up @@ -186,9 +186,9 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(16.40000006184)
float(16.4000000618%s)
[1]=>
float(48.199999993667)
float(48.19999999366%s)
}
}
array(2) {
Expand All @@ -197,8 +197,8 @@ array(2) {
["coordinates"]=>
array(2) {
[0]=>
float(179.99999983236)
float(179.9999998323%s)
[1]=>
float(89.999999916181)
float(89.99999991618%s)
}
}
8 changes: 4 additions & 4 deletions tests/helmert.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ $z = 5020322.478;

var_dump(helmert($x, $y, $z));
?>
--EXPECT--
--EXPECTF--
array(3) {
["x"]=>
float(3909460.0676711)
float(3909460.067671%s)
["y"]=>
float(-146987.30138174)
float(-146987.301381%s)
["z"]=>
float(5019888.0705933)
float(5019888.070593%s)
}
4 changes: 2 additions & 2 deletions tests/initial_bearing1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ $to = array(
);
var_dump(initial_bearing($from, $to));
?>
--EXPECT--
float(148.270892801715)
--EXPECTF--
float(148.27089280171%s)
4 changes: 2 additions & 2 deletions tests/initial_bearing2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ $to = array(
);
var_dump(initial_bearing($from, $to));
?>
--EXPECT--
float(337.890440190492)
--EXPECTF--
float(337.89044019049%s)
8 changes: 4 additions & 4 deletions tests/polar_to_cartesian.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ $long = 1.4669444444;

var_dump(polar_to_cartesian($lat, $long, GEO_AIRY_1830));
?>
--EXPECT--
--EXPECTF--
array(3) {
["x"]=>
float(3810891.6734396)
float(3810891.673439%s)
["y"]=>
float(97591.624686311)
float(97591.62468631%s)
["z"]=>
float(5095766.3939034)
float(5095766.393903%s)
}