r67076 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67075‎ | r67076 | r67077 >
Date:15:17, 30 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed bug
Modified paths:
  • /trunk/extensions/Maps/Maps_CoordinateParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps_CoordinateParser.php
@@ -405,6 +405,8 @@
406406 * FIXME: fix innacuracy
407407 */
408408 private static function parseDMSCoordinate( $coordinate ) {
 409+ $coordinate = str_replace( ' ', '', $coordinate );
 410+
409411 $isNegative = substr( $coordinate, 0, 1 ) == '-';
410412 if ( $isNegative ) $coordinate = substr( $coordinate, 1 );
411413
@@ -412,11 +414,13 @@
413415 $minutePosition = strpos( $coordinate, Maps_GEO_MIN );
414416 $secondPosition = strpos( $coordinate, Maps_GEO_SEC );
415417
416 - $minuteLength = $minutePosition - $degreePosition - 1;
 418+ $degSignLength = strlen( Maps_GEO_DEG );
 419+
 420+ $minuteLength = $minutePosition - $degreePosition - $degSignLength;
417421 $secondLength = $secondPosition - $minutePosition - 1;
418422
419423 $degrees = substr ( $coordinate, 0, $degreePosition );
420 - $minutes = substr ( $coordinate, $degreePosition + 1, $minuteLength );
 424+ $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength );
421425 $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength );
422426
423427 $coordinate = $degrees + ( $minutes + $seconds / 60 ) / 60;

Status & tagging log