This is a clone of the pull request I created in the official GeoPHP repository on Github: https://github.com/phayes/geoPHP/pull/115

It began in this issue: https://github.com/phayes/geoPHP/issues/114

I will put together a patch that includes these changes in the GeoPHP Drupal module, so that I can include it in my makefile. Ultimately, if the pull request is merged in, then we can simply update the GeoPHP library code in this module and it will accomplish the same goal. So don't worry about reviewing this patch (I just need it for Drush make) - but instead you can focus on reviewing the pull request on Github. :-)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Status: Active » Needs work
FileSize
9.91 KB

Patch attached! Setting this to Needs Review - but really the pull request is what needs review: https://github.com/phayes/geoPHP/pull/115

This patch is just a copy of that pull request.

m.stenta’s picture

Status: Needs work » Needs review
m.stenta’s picture

Title: Use BCMath for arithmetic » Use BCMath for GeoPHP arithmetic
m.stenta’s picture

A bug was discovered with this patch that affects PHP 7.2+. See #3050510: Error: Call to a member function getY() on null in Polygon->area().

I fixed the bug in the upstream pull request, and also removed the code that sets bcscale(24) globally, which is only necessary in cases where the area/length of small latitude/longitude geometries are being calculated (originally described here: https://github.com/phayes/geoPHP/issues/114#issuecomment-160463523). See my latest comment on the upstream GeoPHP issue here: https://github.com/phayes/geoPHP/issues/114#issuecomment-569951690, and the upstream pull request here: https://github.com/phayes/geoPHP/pull/115

Attached is an updated patch that reflects these changes.