[fusion-commits] r2937 - in trunk: layers/MapGuide/php widgets/SelectWithin
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed May 4 07:32:55 PDT 2016
Author: jng
Date: 2016-05-04 07:32:55 -0700 (Wed, 04 May 2016)
New Revision: 2937
Modified:
trunk/layers/MapGuide/php/Utilities.php
trunk/widgets/SelectWithin/SelectWithin.php
Log:
Fix some PHP warnings/errors:
- Not initializing arbitrary objects with "new stdClass()"
- Blindly accessing 'property_mappings' of $_SESSION without first checking if it exists first.
Modified: trunk/layers/MapGuide/php/Utilities.php
===================================================================
--- trunk/layers/MapGuide/php/Utilities.php 2016-05-04 14:06:11 UTC (rev 2936)
+++ trunk/layers/MapGuide/php/Utilities.php 2016-05-04 14:32:55 UTC (rev 2937)
@@ -791,7 +791,7 @@
array_push($properties->$layerName->metadatanames, 'area');
array_push($properties->$layerName->metadatanames, 'length');
- if (isset($_SESSION)) {
+ if (isset($_SESSION) && array_key_exists('property_mappings', $_SESSION)) {
$mappings = $_SESSION['property_mappings'][$layerObj->GetObjectId()];
foreach((array)$mappings as $name => $value)
{
Modified: trunk/widgets/SelectWithin/SelectWithin.php
===================================================================
--- trunk/widgets/SelectWithin/SelectWithin.php 2016-05-04 14:06:11 UTC (rev 2936)
+++ trunk/widgets/SelectWithin/SelectWithin.php 2016-05-04 14:32:55 UTC (rev 2937)
@@ -50,11 +50,11 @@
$map->Open($mapName);
//object to hold response
- $result = NULL;
+ $result = new stdClass();
$result->hasSelection = false;
/*holds selection array*/
- $properties = NULL;
+ $properties = new stdClass();
$properties->layers = array();
$layers = explode(",", $layers);
@@ -88,14 +88,14 @@
if ($oExtents) {
$oMin = $oExtents->GetLowerLeftCoordinate();
$oMax = $oExtents->GetUpperRightCoordinate();
- $result->extents = NULL;
+ $result->extents = new stdClass();
$result->extents->minx = $oMin->GetX();
$result->extents->miny = $oMin->GetY();
$result->extents->maxx = $oMax->GetX();
$result->extents->maxy = $oMax->GetY();
/*keep the full extents of the selection when saving the selection in the session*/
- $properties->extents = NULL;
+ $properties->extents = new stdClass();
$properties->extents->minx = $oMin->GetX();
$properties->extents->miny = $oMin->GetY();
$properties->extents->maxx = $oMax->GetX();
@@ -117,6 +117,7 @@
array_push($result->layers, $layerName);
array_push($properties->layers, $layerName);
$count = $resultSel->GetSelectedFeaturesCount($layer, $layerClassName);
+ $result->$layerName = new stdClass();
$result->$layerName->featureCount = $count;
}
More information about the fusion-commits
mailing list