Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#710 closed defect (fixed)

PATCH: selection containing Datetime values causes exception

Reported by: poulet1212 Owned by: trevorwekel
Priority: high Milestone: 2.2
Component: Fusion Version: 2.0.2
Severity: major Keywords: mgdatetime selection exception
Cc: External ID: 1127807

Description

File: www\fusion\mapguide\php\Utilities.php

Function function BuildSelectionArray, around line 865

The code here:

$value =  GetPropertyValueFromFeatReader(...);
$value = htmlentities($value);

Should be changed like this (to avoid exeption of htmlentities on an MGDateTime object)

$value =  GetPropertyValueFromFeatReader(...);
if($value instanceof MgDateTime)
   $value = printDateTime($value);
$value = htmlentities($value);

where printDateTime is a String representation of MGDateTime Object:

function printDateTime($mgDateTime)
{
   $dayToday = $mgDateTime->GetDay();
   $month = $mgDateTime->GetMonth();
   $year = $mgDateTime->GetYear();
   return $dayToday.".".$month.".".$year;
}

cheers, Rémy

Change History (4)

comment:1 by trevorwekel, 16 years ago

Owner: set to trevorwekel
Status: newassigned

A simpler fix is to call ToString() method on the MgDateTime object to return a human-readable string.

Fix has been put into 2.0.x stream with http://trac.osgeo.org/mapguide/changeset/3349

comment:2 by trevorwekel, 16 years ago

External ID: 1127807

comment:3 by trevorwekel, 16 years ago

Resolution: fixed
Status: assignedclosed

comment:4 by poulet1212, 16 years ago

Yes, good idea to use ToString() in place of this printDateTime() function, didn't knew it :-)

Note: See TracTickets for help on using tickets.