Fix possible out-of-bound array access in GMapsGeocoder::getTextToGeocode
authorNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Sun, 5 Oct 2014 14:46:52 +0000 (16:46 +0200)
committerNicolas Iooss <nicolas.iooss_git@polytechnique.org>
Sun, 5 Oct 2014 14:50:58 +0000 (16:50 +0200)
classes/gmapsgeocoder.php

index c16ebba..e009080 100644 (file)
@@ -241,6 +241,9 @@ class GMapsGeocoder extends Geocoder {
         }
         $textLines  = explode("\n", $text);
         $countLines = count($textLines);
+        if ($countLines < 2) {
+            return $text;
+        }
         $needle     = strtoupper(trim($textLines[$countLines - 2]));
         $isPseudoCountry = false;
         if ($needle) {