r90153 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90152‎ | r90153 | r90154 >
Date:20:55, 15 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
MFT r90151 and r90152
Modified paths:
  • /branches/Maps0.7.x/RELEASE-NOTES (modified) (history)
  • /branches/Maps0.7.x/includes/Maps_CoordinateParser.php (modified) (history)

Diff [purge]

Index: branches/Maps0.7.x/RELEASE-NOTES
@@ -14,6 +14,8 @@
1515
1616 * Fixed bug in OpenLayers layer dependency loading code.
1717
 18+* Fixed DMS coordinate parsing issue (bug 29419).
 19+
1820 * Removed dead code (initial code to support the RL, now used in SM 1.0 and later).
1921
2022 * Use of Google Maps geocoding service v3 instead of v2.
Index: branches/Maps0.7.x/includes/Maps_CoordinateParser.php
@@ -524,17 +524,28 @@
525525 if ( $isNegative ) $coordinate = substr( $coordinate, 1 );
526526
527527 $degreePosition = strpos( $coordinate, self::SYMBOL_DEG );
 528+ $degrees = substr ( $coordinate, 0, $degreePosition );
 529+
528530 $minutePosition = strpos( $coordinate, self::SYMBOL_MIN );
529 - $secondPosition = strpos( $coordinate, self::SYMBOL_SEC );
530531
531 - $degSignLength = strlen( self::SYMBOL_DEG );
 532+ if ( $minutePosition === false ) {
 533+ $minutes = 0;
 534+ }
 535+ else {
 536+ $degSignLength = strlen( self::SYMBOL_DEG );
 537+ $minuteLength = $minutePosition - $degreePosition - $degSignLength;
 538+ $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength );
 539+ }
532540
533 - $minuteLength = $minutePosition - $degreePosition - $degSignLength;
534 - $secondLength = $secondPosition - $minutePosition - 1;
 541+ $secondPosition = strpos( $coordinate, self::SYMBOL_SEC );
535542
536 - $degrees = substr ( $coordinate, 0, $degreePosition );
537 - $minutes = substr ( $coordinate, $degreePosition + $degSignLength, $minuteLength );
538 - $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength );
 543+ if ( $minutePosition === false ) {
 544+ $seconds = 0;
 545+ }
 546+ else {
 547+ $secondLength = $secondPosition - $minutePosition - 1;
 548+ $seconds = substr ( $coordinate, $minutePosition + 1, $secondLength );
 549+ }
539550
540551 $coordinate = $degrees + ( $minutes + $seconds / 60 ) / 60;
541552 if ( $isNegative ) $coordinate *= -1;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90151address bug 29419jeroendedauw20:52, 15 June 2011
r90152up rel notesjeroendedauw20:54, 15 June 2011

Status & tagging log