[Mapbender-commits] r6963 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 29 08:47:35 EDT 2010


Author: christoph
Date: 2010-09-29 12:47:35 +0000 (Wed, 29 Sep 2010)
New Revision: 6963

Modified:
   trunk/mapbender/http/classes/class_bbox.php
Log:
throw exception in input parameters not valid

Modified: trunk/mapbender/http/classes/class_bbox.php
===================================================================
--- trunk/mapbender/http/classes/class_bbox.php	2010-09-29 12:44:53 UTC (rev 6962)
+++ trunk/mapbender/http/classes/class_bbox.php	2010-09-29 12:47:35 UTC (rev 6963)
@@ -45,11 +45,12 @@
 			$param2 = func_get_arg(2);
 		}
 		else {
+			throw new Exception("Invalid argument count.");
 			return;
 		}
 		
 		// params are point, point, epsg
-		if (is_a($param0, "Mapbender_point") && is_a($param1, "Mapbender_point") && !$param3 && !$param4) {
+		if (is_a($param0, "Mapbender_point") && is_a($param1, "Mapbender_point") && is_string($param2) && !$param3 && !$param4) {
 			$e = new mb_notice("Mapbender_bbox: constructor: point1, point2, epsg");
 			$min = $param0; // is a Mapbender_point
 			$max = $param1; // is a Mapbender_point
@@ -70,10 +71,10 @@
 			}
 		}
 		// params are x1, y1, x2, xy, epsg
-		else {
+		else if (is_numeric($param0) && is_numeric($param1) && is_numeric($param2) && is_numeric($param3) && is_string($param4)) {
 			$e = new mb_notice("Mapbender_bbox: constructor: x1, y1, x2, y2, epsg");
-			$min = new Mapbender_point($param0, $param1, $param4);
-			$max = new Mapbender_point($param2, $param3, $param4);
+			$min = new Mapbender_point(floatval($param0), floatval($param1), $param4);
+			$max = new Mapbender_point(floatval($param2), floatval($param3), $param4);
 			$epsg = $param4; // is an EPSG code like "EPSG:4326"
 			
 			if ($min->isWestOf($max) && $min->isSouthOf($max)) {
@@ -89,8 +90,10 @@
 			else {
 				$e = new mb_exception("Mapbender_bbox: constructor: min (".$this->min.") is not southwest of max (".$this->max.")!");
 			}
-			
 		}
+		else {
+			throw new Exception("invalid parameters to Mapbender_bbox");
+		}
 	}
 
 	public static function createFromLayerEpsg ($c) {



More information about the Mapbender_commits mailing list