[Git][debian-gis-team/mapserver][upstream] New upstream version 7.4.0~beta2

Bas Couwenberg gitlab at salsa.debian.org
Thu Apr 18 05:45:39 BST 2019



Bas Couwenberg pushed to branch upstream at Debian GIS Project / mapserver


Commits:
e3399435 by Bas Couwenberg at 2019-04-18T04:23:29Z
New upstream version 7.4.0~beta2
- - - - -


24 changed files:

- CMakeLists.txt
- HISTORY.TXT
- Makefile
- mapkmlrenderer.cpp
- mapmssql2008.c
- mapogcfilter.c
- mapogcfiltercommon.c
- mapproject.c
- mapscript/perl/CMakeLists.txt
- mapscript/perl/examples/RFC24.pl
- mapscript/perl/examples/shp_in_shp.pl
- mapscript/perl/examples/thin.pl
- + mapscript/perl/tests/0-load.t
- + mapscript/perl/tests/maps.t
- mapscript/php/CMakeLists.txt
- − mapscript/php/php_proj.c
- mapscript/phpng/CMakeLists.txt
- mapscript/python/examples/project_csv.py
- mapscript/python/examples/shpdump.py
- mapscript/python/examples/shpinfo.py
- mapscript/python/examples/wxs.py
- mapscript/swiginc/image.i
- mapscript/swiginc/msio.i
- maptemplate.c


Changes:

=====================================
CMakeLists.txt
=====================================
@@ -18,7 +18,7 @@ include(CheckCSourceCompiles)
 set (MapServer_VERSION_MAJOR 7)
 set (MapServer_VERSION_MINOR 4)
 set (MapServer_VERSION_REVISION 0)
-set (MapServer_VERSION_SUFFIX "-beta1")
+set (MapServer_VERSION_SUFFIX "-beta2")
 
 set(TARGET_VERSION_MAJOR ${MapServer_VERSION_MAJOR})
 set(TARGET_VERSION_MINOR ${MapServer_VERSION_MINOR})


=====================================
HISTORY.TXT
=====================================
@@ -12,6 +12,15 @@ For a complete change history, please see the Git log comments.  For more
 details about recent point releases, please see the online changelog at:
 http://mapserver.org/development/changelog/
 
+7.4.0-beta2 release (2019-4-17)
+-------------------------------
+
+- Addresses XSS issue with [layers] template tag (fix available in 6.4, 7.0 and 7.2 branches as well)
+
+- Added Perl/Mapscript to Travis CI
+
+- No other major changes, see detailed changelog for bug fixes
+
 7.4.0-beta1 release (2019-3-29)
 -------------------------------
 


=====================================
Makefile
=====================================
@@ -3,12 +3,13 @@ PHP_MAPSCRIPT=build/mapscript/php/php_mapscript.so
 PYTHON_MAPSCRIPT_PATH=build/mapscript/python
 JAVA_MAPSCRIPT_PATH=build/mapscript/java
 CSHARP_MAPSCRIPT_PATH=build/mapscript/csharp
+PERL_MAPSCRIPT_PATH=build/mapscript/perl
 BUILDPATH=../../build
 FLEX=flex
 YACC=yacc
 CMAKEFLAGS=-DCMAKE_C_FLAGS="--coverage" -DCMAKE_CXX_FLAGS="--coverage" \
 			  -DCMAKE_SHARED_LINKER_FLAGS="-lgcov" -DWITH_CLIENT_WMS=1 \
-			  -DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 \
+			  -DWITH_CLIENT_WFS=1 -DWITH_KML=1 -DWITH_SOS=1 -DWITH_CSHARP=1 -DWITH_PHP=1 -DWITH_PERL=1 \
 			  -DWITH_PYTHON=1 -DWITH_JAVA=1 -DWITH_THREAD_SAFETY=1 -DWITH_FRIBIDI=1 -DWITH_FCGI=0 -DWITH_EXEMPI=1 \
 			  -DCMAKE_BUILD_TYPE=Release -DWITH_RSVG=1 -DWITH_CURL=1 -DWITH_HARFBUZZ=1 -DWITH_POINT_Z_M=1
 all: cmakebuild
@@ -50,11 +51,23 @@ java-testcase:
 csharp-testcase:
 	test -d "$(CSHARP_MAPSCRIPT_PATH)" && (export CSHARP_MAPSCRIPT_SO="../../$(CSHARP_MAPSCRIPT_PATH)" && cd mapscript/csharp && ./run_test.sh)
 
+perl-testcase:
+	cd "$(PERL_MAPSCRIPT_PATH)" \
+	&& PERL5LIB=`pwd` \
+	&& prove tests \
+	&& perl examples/RFC24.pl ../../../tests/test.map \
+	&& perl examples/shp_in_shp.pl --infile1 ../../../tests/line.shp --infile1_shpid 0 --infile2 ../../../tests/polygon.shp --infile2_shpid 0 \
+	&& perl examples/dump.pl --file ../../../tests/line.shp \
+	&& perl examples/thin.pl --input ../../../tests/polygon --output examples/junk --tolerance=5
+
+
+
 test:  cmakebuild
 	@$(MAKE) $(MFLAGS)	wxs-testcase renderers-testcase misc-testcase gdal-testcase query-testcase mspython-testcase
 	@./print-test-results.sh
 	@$(MAKE) $(MFLAGS)	php-testcase
 	@$(MAKE) $(MFLAGS)	csharp-testcase
+	@$(MAKE) $(MFLAGS)	perl-testcase
 
 
 lexer: maplexer.c


=====================================
mapkmlrenderer.cpp
=====================================
@@ -355,7 +355,7 @@ int KmlRenderer::startNewLayer(imageObj *img, layerObj *layer)
 
     /*check for image path and image url*/
     if (layer->map->debug && (layer->map->web.imageurl == NULL ||   layer->map->web.imagepath == NULL))
-      msDebug("KmlRenderer::startNewLayer: imagepath and imageurl sould be set in the web object\n");
+      msDebug("KmlRenderer::startNewLayer: imagepath and imageurl should be set in the web object\n");
 
 
     /*map rect for ground overlay*/


=====================================
mapmssql2008.c
=====================================
@@ -247,6 +247,7 @@ typedef struct ms_MSSQL2008_layer_info_t {
   char *user_srid;     /* zero length = calculate, non-zero means using this value! */
   char *index_name;  /* hopefully this isn't necessary - but if the optimizer ain't cuttin' it... */
   char *sort_spec;  /* the sort by specification which should be applied to the generated select statement */
+  int mssqlversion_major; /* the sql server major version number */
   SQLSMALLINT *itemtypes; /* storing the sql field types for further reference */
 
   msODBCconn * conn;          /* Connection to db */
@@ -973,6 +974,7 @@ int msMSSQL2008LayerOpen(layerObj *layer)
   layerinfo->sort_spec = NULL;
   layerinfo->conn = NULL;
   layerinfo->itemtypes = NULL;
+  layerinfo->mssqlversion_major = 0;
 
   layerinfo->conn = (msODBCconn *) msConnPoolRequest(layer);
 
@@ -1102,26 +1104,162 @@ int msMSSQL2008LayerInitItemInfo(layerObj *layer)
   return MS_SUCCESS;
 }
 
+static int getMSSQLMajorVersion(layerObj* layer)
+{
+  msMSSQL2008LayerInfo  *layerinfo = getMSSQL2008LayerInfo(layer);
+  if (layerinfo == NULL)
+    return 0;
+
+  if (layerinfo->mssqlversion_major == 0) {
+    char* mssqlversion_major = msLayerGetProcessingKey(layer, "MSSQL_VERSION_MAJOR");
+    if (mssqlversion_major != NULL) {
+      layerinfo->mssqlversion_major = atoi(mssqlversion_major);
+    }
+    else {
+      /* need to query from database */
+      if (executeSQL(layerinfo->conn, "SELECT SERVERPROPERTY('ProductVersion')")) {
+        SQLRETURN rc = SQLFetch(layerinfo->conn->hstmt);
+        if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
+          /* process results */
+          char result_data[256];
+          SQLLEN retLen = 0;
+
+          rc = SQLGetData(layerinfo->conn->hstmt, 1, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
+
+          if (rc != SQL_ERROR) {
+            result_data[retLen] = 0;
+            layerinfo->mssqlversion_major = atoi(result_data);
+          }
+        }
+      }
+    }
+  }
+
+  return layerinfo->mssqlversion_major;
+}
+
 /* Get the layer extent as specified in the mapfile or a largest area */
 /* covering all features */
 int msMSSQL2008LayerGetExtent(layerObj *layer, rectObj *extent)
 {
-  if(layer->debug) {
-    msDebug("msMSSQL2008LayerGetExtent called\n");
-  }
+    msMSSQL2008LayerInfo *layerinfo;
+    char *query = 0;
+    char result_data[256];
+    SQLLEN retLen;
+    SQLRETURN rc;
+    
+    if(layer->debug) {
+      msDebug("msMSSQL2008LayerGetExtent called\n");
+    }
 
-  if (layer->extent.minx == -1.0 && layer->extent.miny == -1.0 &&
-      layer->extent.maxx == -1.0 && layer->extent.maxy == -1.0) {
-    extent->minx = extent->miny = -1.0 * FLT_MAX;
-    extent->maxx = extent->maxy = FLT_MAX;
-  } else {
-    extent->minx = layer->extent.minx;
-    extent->miny = layer->extent.miny;
-    extent->maxx = layer->extent.maxx;
-    extent->maxy = layer->extent.maxy;
-  }
+    if (!(layer->extent.minx == -1.0 && layer->extent.miny == -1.0 && 
+        layer->extent.maxx == -1.0 && layer->extent.maxy == -1.0)) {
+      /* extent was already set */
+      extent->minx = layer->extent.minx;
+      extent->miny = layer->extent.miny;
+      extent->maxx = layer->extent.maxx;
+      extent->maxy = layer->extent.maxy;
+    }
 
-  return MS_SUCCESS;
+    layerinfo = getMSSQL2008LayerInfo(layer);
+
+    if (!layerinfo) {
+        msSetError(MS_QUERYERR, "GetExtent called with layerinfo = NULL", "msMSSQL2008LayerGetExtent()");
+        return MS_FAILURE;
+    }
+
+    /* set up statement */
+    if (getMSSQLMajorVersion(layer) >= 11) {
+      if (strcasecmp(layerinfo->geom_column_type, "geography") == 0) {
+        query = msStringConcatenate(query, "WITH extent(extentcol) AS (SELECT geometry::EnvelopeAggregate(geometry::STGeomFromWKB(");
+        query = msStringConcatenate(query, layerinfo->geom_column);
+        query = msStringConcatenate(query, ".STAsBinary(), ");
+        query = msStringConcatenate(query, layerinfo->geom_column);
+        query = msStringConcatenate(query, ".STSrid)");
+      }
+      else {
+        query = msStringConcatenate(query, "WITH extent(extentcol) AS (SELECT geometry::EnvelopeAggregate(");
+        query = msStringConcatenate(query, layerinfo->geom_column);        
+      }
+      query = msStringConcatenate(query, ".MakeValid()) AS extentcol FROM ");
+      query = msStringConcatenate(query, layerinfo->geom_table);
+      query = msStringConcatenate(query, ") SELECT extentcol.STPointN(1).STX, extentcol.STPointN(1).STY, extentcol.STPointN(3).STX, extentcol.STPointN(3).STY FROM extent");
+    }
+    else {
+      if (strcasecmp(layerinfo->geom_column_type, "geography") == 0) {
+        query = msStringConcatenate(query, "WITH ENVELOPE as (SELECT geometry::STGeomFromWKB(");
+        query = msStringConcatenate(query, layerinfo->geom_column);
+        query = msStringConcatenate(query, ".STAsBinary(), ");
+        query = msStringConcatenate(query, layerinfo->geom_column);
+        query = msStringConcatenate(query, ".STSrid)");
+      }
+      else {
+        query = msStringConcatenate(query, "WITH ENVELOPE as (SELECT ");
+        query = msStringConcatenate(query, layerinfo->geom_column);      
+      }
+      query = msStringConcatenate(query, ".MakeValid().STEnvelope() as envelope from ");
+      query = msStringConcatenate(query, layerinfo->geom_table);
+      query = msStringConcatenate(query, "), CORNERS as (SELECT envelope.STPointN(1) as point from ENVELOPE UNION ALL select envelope.STPointN(3) from ENVELOPE) SELECT MIN(point.STX), MIN(point.STY), MAX(point.STX), MAX(point.STY) FROM CORNERS");
+    }
+
+    if (!executeSQL(layerinfo->conn, query)) {
+        msFree(query);
+        return MS_FAILURE;
+    }
+
+    msFree(query);
+
+    /* process results */
+    rc = SQLFetch(layerinfo->conn->hstmt);
+
+    if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
+        if (layer->debug) {
+            msDebug("msMSSQL2008LayerGetExtent: No results found.\n");
+        }
+        return MS_FAILURE;
+    }
+
+    rc = SQLGetData(layerinfo->conn->hstmt, 1, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
+    if (rc == SQL_ERROR) {
+        msSetError(MS_QUERYERR, "Failed to get MinX value", "msMSSQL2008LayerGetExtent()");
+        return MS_FAILURE;
+    }
+
+    result_data[retLen] = 0;
+
+    extent->minx = atof(result_data);
+
+    rc = SQLGetData(layerinfo->conn->hstmt, 2, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
+    if (rc == SQL_ERROR) {
+        msSetError(MS_QUERYERR, "Failed to get MinY value", "msMSSQL2008LayerGetExtent()");
+        return MS_FAILURE;
+    }
+
+    result_data[retLen] = 0;
+
+    extent->miny = atof(result_data);
+
+    rc = SQLGetData(layerinfo->conn->hstmt, 3, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
+    if (rc == SQL_ERROR) {
+        msSetError(MS_QUERYERR, "Failed to get MaxX value", "msMSSQL2008LayerGetExtent()");
+        return MS_FAILURE;
+    }
+
+    result_data[retLen] = 0;
+
+    extent->maxx = atof(result_data);
+
+    rc = SQLGetData(layerinfo->conn->hstmt, 4, SQL_C_CHAR, result_data, sizeof(result_data), &retLen);
+    if (rc == SQL_ERROR) {
+        msSetError(MS_QUERYERR, "Failed to get MaxY value", "msMSSQL2008LayerGetExtent()");
+        return MS_FAILURE;
+    }
+
+    result_data[retLen] = 0;
+
+    extent->maxy = atof(result_data);
+
+    return MS_SUCCESS;
 }
 
 /* Get the layer feature count */
@@ -1358,19 +1496,15 @@ static int prepare_database(layerObj *layer, rectObj rect, char **query_string)
   }
 
   /* adding spatial filter */
-  msMSSQL2008LayerGetExtent(layer, &extent);
-  if (rect.minx > extent.minx || rect.miny > extent.miny ||
-      rect.maxx < extent.maxx || rect.maxy < extent.maxy) {
-      if (hasFilter == MS_FALSE)
-          query = msStringConcatenate(query, " WHERE ");
-      else
-          query = msStringConcatenate(query, " AND ");
+  if (hasFilter == MS_FALSE)
+      query = msStringConcatenate(query, " WHERE ");
+  else
+      query = msStringConcatenate(query, " AND ");
 
-      query = msStringConcatenate(query, layerinfo->geom_column);
-      query = msStringConcatenate(query, ".STIntersects(");
-      query = msStringConcatenate(query, box3d);
-      query = msStringConcatenate(query, ") = 1 ");
-  }
+  query = msStringConcatenate(query, layerinfo->geom_column);
+  query = msStringConcatenate(query, ".MakeValid().STIntersects(");
+  query = msStringConcatenate(query, box3d);
+  query = msStringConcatenate(query, ") = 1 ");
 
   if (layerinfo->sort_spec)
       query = msStringConcatenate(query, layerinfo->sort_spec);


=====================================
mapogcfilter.c
=====================================
@@ -3171,7 +3171,7 @@ int FLTCheckFeatureIdFilters(FilterEncodingNode *psFilterNode,
         tokens = msStringSplit(psFilterNode->pszValue,',', &nTokens);
         for (j=0; j<nTokens; j++) {
             const char* pszId = tokens[j];
-            const char* pszDot = strchr(pszId, '.');
+            const char* pszDot = strrchr(pszId, '.');
             if( pszDot )
             {
                 if( pszDot - pszId != strlen(lp->name) ||


=====================================
mapogcfiltercommon.c
=====================================
@@ -645,7 +645,7 @@ char *FLTGetFeatureIdCommonExpression(FilterEncodingNode *psFilterNode, layerObj
           char *pszTmp = NULL;
           int bufferSize = 0;
           const char* pszId = tokens[i];
-          const char* pszDot = strchr(pszId, '.');
+          const char* pszDot = strrchr(pszId, '.');
           if( pszDot )
             pszId = pszDot + 1;
 


=====================================
mapproject.c
=====================================
@@ -806,7 +806,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
   lineObj  ring;
   /*  pointObj ringPoints[NUMBER_OF_SAMPLE_POINTS*4+4]; */
   pointObj *ringPoints;
-  int     ix, iy;
+  int     ix, iy, ixy;
 
   double dx, dy;
 
@@ -841,7 +841,8 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
   }
 
   /* -------------------------------------------------------------------- */
-  /*      Build polygon as steps around the source rectangle.             */
+  /*      Build polygon as steps around the source rectangle              */
+  /*      and possibly its diagonal.                                      */
   /* -------------------------------------------------------------------- */
   dx = (rect->maxx - rect->minx)/NUMBER_OF_SAMPLE_POINTS;
   dy = (rect->maxy - rect->miny)/NUMBER_OF_SAMPLE_POINTS;
@@ -857,7 +858,8 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
     return MS_SUCCESS;
   }
   
-  ringPoints = (pointObj*) calloc(sizeof(pointObj),NUMBER_OF_SAMPLE_POINTS*4+4);
+  /* If there is more than two sample points we will also get samples from the diagonal line */
+  ringPoints = (pointObj*) calloc(sizeof(pointObj),NUMBER_OF_SAMPLE_POINTS*5+3);
   ring.point = ringPoints;
   ring.numpoints = 0;
 
@@ -872,7 +874,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
     }
   }
 
-  /* sample on along right side */
+  /* sample along right side */
   if(dy != 0) {
     for(iy = 1; iy <= NUMBER_OF_SAMPLE_POINTS; iy++ ) {
       ringPoints[ring.numpoints].x = rect->maxx;
@@ -888,7 +890,7 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
     }
   }
 
-  /* sample on along left side */
+  /* sample along left side */
   if(dy != 0) {
     for(iy = NUMBER_OF_SAMPLE_POINTS-1; iy >= 0; iy-- ) {
       ringPoints[ring.numpoints].x = rect->minx;
@@ -896,6 +898,17 @@ msProjectRectAsPolygon(projectionObj *in, projectionObj *out,
     }
   }
 
+  /* sample along diagonal line */
+  /* This is done to handle cases where reprojection from world covering projection to one */
+  /* which isn't could cause min and max values of the projected rectangle to be invalid */
+  if(dy != 0 && dx != 0) {
+    /* No need to compute corners as they've already been computed */
+    for(ixy = NUMBER_OF_SAMPLE_POINTS-2; ixy >= 1; ixy-- ) {
+      ringPoints[ring.numpoints].x = rect->minx + ixy * dx;
+      ringPoints[ring.numpoints++].y = rect->miny + ixy * dy;
+    }
+  }
+
   msAddLineDirectly( &polygonObj, &ring );
 
 #ifdef notdef


=====================================
mapscript/perl/CMakeLists.txt
=====================================
@@ -25,3 +25,6 @@ endif(APPLE)
 
 install(FILES $<TARGET_FILE:${SWIG_MODULE_perlmapscript_REAL_NAME}> DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR}/auto/mapscript)
 install(FILES $<TARGET_FILE_DIR:${SWIG_MODULE_perlmapscript_REAL_NAME}>/mapscript.pm DESTINATION ${CUSTOM_PERL_SITE_ARCH_DIR})
+
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION  ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples DESTINATION  ${CMAKE_CURRENT_BINARY_DIR})


=====================================
mapscript/perl/examples/RFC24.pl
=====================================
@@ -1,6 +1,10 @@
 #!/usr/bin/perl
+use strict;
+use warnings;
 use mapscript;
-$file=$ARGV[0];
+use Data::Dumper;
+
+my $file=$ARGV[0];
 
 # utility
 sub assertNotNull {
@@ -12,13 +16,6 @@ sub assertNotNull {
 	}
 }
 
-sub dumpHash {
-	my ($hashmap) = @_;
-	print "Dumping hashmap: $hashmap\n";
-	for my $k ( keys %$hashmap ) {
-		    print "\t".$k.": ".$hashmap{$k}."\n";
-	}
-}
 
 # layerObj
 sub testGetLayerObj {
@@ -49,7 +46,7 @@ sub testInsertLayerObj {
 	my $position = $map->insertLayer($layer);
 	$map = undef;
 	assertNotNull( $position == 7 , "testInsertLayerObj position");
-	assertNotNull( $layer->{map} , "testInsertLayerObj notnull");	
+	assertNotNull( $layer->{map} , "testInsertLayerObj notnull");
 }
 
 # classObj
@@ -83,7 +80,7 @@ sub testInsertClassObj {
 	my $position = $layer->insertClass($clazz);
 	$map = undef; $layer=undef;
 	assertNotNull( $position == 2 , "testInsertClassObj position");
-	assertNotNull( $clazz->{layer} , "testInsertClassObj notnull");	
+	assertNotNull( $clazz->{layer} , "testInsertClassObj notnull");
 }
 
 if ( ! $file ) {
@@ -99,8 +96,9 @@ testGetClassObj;
 testClassObj;
 testInsertClassObj;
 
-$hashmap=mapscript::getPARENT_PTRS();
+my $hashmap = mapscript::getPARENT_PTRS();
 assertNotNull( keys( %$hashmap )==0 , "checking that hashmap of parent ptrs is empty");
 print "No of keys:".keys( %$hashmap )."\n";
-dumpHash($hashmap);
+#dumpHash($hashmap);
+print Dumper( $hashmap );
 


=====================================
mapscript/perl/examples/shp_in_shp.pl
=====================================
@@ -9,8 +9,6 @@
 
 use strict;
 use warnings;
-use POSIX;
-use XBase;
 use mapscript;
 use Getopt::Long;
 use File::Copy;
@@ -19,7 +17,8 @@ my ($infile1, $infile1_shpid, $infile2, $infile2_shpid, $within);
 
 GetOptions("infile1=s", \$infile1, "infile1_shpid=s", \$infile1_shpid, "infile2=s", \$infile2, "infile2_shpid=s", \$infile2_shpid);
 
-if(!$infile1 or !$infile1_shpid or !$infile2 or !$infile2_shpid) {
+# shpid can be zero, which looks false, so use defined()
+if(!$infile1 or !defined($infile1_shpid) or !$infile2 or !defined($infile2_shpid)) {
   print "Usage: $0 --infile1=[filename] --infile1_shpid=[shpid] --infile2=[filename] --infile2_shpid=[shpid]\n";
   exit 0;
 }


=====================================
mapscript/perl/examples/thin.pl
=====================================
@@ -10,8 +10,6 @@
 
 use strict;
 use warnings;
-use POSIX;
-use XBase;
 use mapscript;
 use Getopt::Long;
 use File::Copy;


=====================================
mapscript/perl/tests/0-load.t
=====================================
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 11;
+
+# check the mapserver version for keywords
+sub msHas
+{
+	my ($mod) = @_;
+	my $ver = mapscript::msGetVersion();
+	if (index($ver, $mod) > -1) {
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
+require_ok( 'mapscript' );
+diag("Testing: " . $INC{'mapscript.pm'});
+diag( mapscript::msGetVersion() );
+
+SKIP: {
+	skip "no geos support", 10 unless msHas('SUPPORTS=GEOS');
+    my @wkt_list = (
+		'POINT (5.0000000000000000 7.0000000000000000)',
+		'LINESTRING (5.0000000000000000 7.0000000000000000, 7.0000000000000000 9.0000000000000000, 9.0000000000000000 -1.0000000000000000)',
+		'POLYGON ((500.0000000000000000 500.0000000000000000, 3500.0000000000000000 500.0000000000000000, 3500.0000000000000000 2500.0000000000000000, 500.0000000000000000 2500.0000000000000000, 500.0000000000000000 500.0000000000000000), (1000.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1500.0000000000000000, 1500.0000000000000000 1000.0000000000000000, 1000.0000000000000000 1000.0000000000000000))',
+		'MULTIPOINT (2000.0000000000000000 2000.0000000000000000, 2000.0000000000000000 1900.0000000000000000)',
+		'MULTILINESTRING ((600.0000000000000000 1500.0000000000000000, 1600.0000000000000000 2500.0000000000000000), (700.0000000000000000 1500.0000000000000000, 1700.0000000000000000 2500.0000000000000000))'
+	);
+
+	for my $orig (@wkt_list)
+	{
+		my $shp = mapscript::shapeObj::fromWKT( $orig );
+		ok( $shp, 'create shapeObj');
+		my $new_wkt = $shp->toWKT();
+		ok( $orig eq $new_wkt, 'from WKT <> toWKT' );
+	}
+};
+


=====================================
mapscript/perl/tests/maps.t
=====================================
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More tests => 10;
+use mapscript;
+
+sub msHas
+{
+	my ($mod) = @_;
+	my $ver = mapscript::msGetVersion();
+	if (index($ver, $mod) > -1) {
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
+# we need to search up directories for the test folder
+my $mapfile = '../../../msautotest/mspython/test_mapio.map';
+if (! -e $mapfile)
+{
+	$mapfile = '../../../../msautotest/mspython/test_mapio.map';
+}
+ok(-e $mapfile, 'mapfile exists');
+
+my $map = new mapscript::mapObj($mapfile);
+ok($map, 'create mapObj');
+
+mapscript::msIO_installStdoutToBuffer();
+my $owreq = new mapscript::OWSRequest();
+ok($owreq, 'create OWSRequest');
+$owreq->loadParamsFromURL('service=WMS&version=1.1.1&request=GetMap&layers=grey&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&width=80&height=40');
+ok($owreq->getName(0) eq 'service');
+ok($owreq->getValue(0) eq 'WMS');
+ok($owreq->getValueByName('request') eq 'GetMap');
+
+my $err = $map->OWSDispatch( $owreq );
+ok($err == 0, 'OWSDispatch');
+
+#	warn(mapscript::msGetErrorString("\n"));
+
+my $h  = mapscript::msIO_getAndStripStdoutBufferMimeHeaders();
+#my $k = $h->nextKey();
+#while ($k)
+#{
+#	diag("$k == " . $h->get($k));
+#	$k = $h->nextKey($k);
+#}
+
+ok($h->get('Cache-Control') eq 'max-age=86400');
+ok($h->get('Content-Type') eq 'image/png');
+
+
+my $x = mapscript::msIO_getStdoutBufferBytes();
+#open(F, '>', 'x.png');
+#print F $$x;
+#close(F);
+
+ok(substr($$x, 1, 3) eq 'PNG');
+
+


=====================================
mapscript/php/CMakeLists.txt
=====================================
@@ -43,4 +43,4 @@ target_link_libraries(php_mapscript ${MAPSERVER_LIBMAPSERVER})
 ENDIF(WIN32)
 
 set_target_properties(php_mapscript PROPERTIES PREFIX "")
-#install(TARGETS php_mapscript DESTINATION ${PHP_EXTENSION_DIR})
+install(TARGETS php_mapscript DESTINATION ${PHP_EXTENSION_DIR})


=====================================
mapscript/php/php_proj.c deleted
=====================================
@@ -1,673 +0,0 @@
-/**********************************************************************
- * $Id$
- *
- * Project:  MapServer
- * Purpose:  PHP wraper function to PROJ4 projection module.
- * Author:   Yewondwossen Assefa, DM Solutions Group (assefa at dmsolutions.ca)
- *
- **********************************************************************
- * Copyright (c) 2000-2005, Y. Assefa, DM Solutions Group inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies of this Software or works derived from this Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- **********************************************************************
- *
- * $Log$
- * Revision 1.10  2005/06/14 16:03:36  dan
- * Updated copyright date to 2005
- *
- * Revision 1.9  2005/01/04 22:55:27  assefa
- * Add PHP5 support for windows (Bug 1100).
- *
- * Revision 1.8  2002/03/08 23:16:41  assefa
- * Add PHP4.1 support.
- *
- * Revision 1.7  2002/01/22 19:18:54  dan
- * Fixed a typo in pj_transform() docs
- *
- * Revision 1.6  2002/01/22 19:18:17  dan
- * Took pj_datum_transform() out of docs to discourage its use.
- *
- * Revision 1.5  2001/09/25 14:52:54  assefa
- * Add pj_transform function.
- *
- * Revision 1.4  2001/02/23 20:35:57  assefa
- * Free function does not work for PHP4. Disable it for now.
- *
- * Revision 1.3  2001/01/09 05:24:41  dan
- * Fixes to build with PHP 4.0.4
- *
- * Revision 1.2  2000/11/08 15:44:16  dan
- * Correct compilation errors with php4.
- *
- * Revision 1.1  2000/11/02 16:39:55  dan
- * PHP PROJ4 module.
- *
- *
- **********************************************************************/
-
-/*
- *         PHP PROJ4 Module
- *
- *  This is a PHP module that gives acces to basic PROJ4 projection
- *  functionalities.
- *
- * There following functions available in this module :
- *
- * 1) pj_init : create and initializes a projection structures
- *
- *    PJ pj_init(array_of_parameters)
- *
- *    Example : $projarray[0] = "proj=lcc";
- *              $projarray[1] = "ellps=GRS80";
- *              $projarray[2] = "lat_0=49";
- *              $projarray[3] = "lon_0=-95";
- *              $projarray[4] = "lat_1=49";
- *              $projarray[5] = "lat_2=77";
- *
- *              $pj = pj_init($projarray);
- *
- * 2) pj_fwd : Performs a projection from lat/long coordinates to
- *             cartesian coordinates.
- *
- * retrun_array pj_fwd(double lat, double long, PJ pj)
- *
- *   Example :  $lat = 45.25;
- *              $long = -75.42;
- *
- *              $ret = pj_fwd($ingeox, $ingeoy, $pj);
- *              printf("geo x = %f<br>\n", $ret["u"]);
- *              printf("geo y = %f<br>\n",$ret["v"]);
- *
- * 3) pj_inv : Performs a projection from cartesian coordinates to
- *             lat/long  coordinates .
- *
- * retrun_array pj_fwd(double geox, double geoy, PJ pj)
- *
- *   Example :  $ingeox = 1537490.335842;
- *              $ingeoy = -181633.471555;
- *
- *              $ret = pj_inv($ingeox, $ingeoy, $pj);
- *              printf("lat = %f<br>\n", $ret["u"]);
- *              printf("lon = %f<br>\n",$ret["v"]);
- *
- *
- * 4) pj_transform : pj_transform(PJ pjsrc, PJ pjdst, double x, double y)
- *      transforms coordinates from source projection to
- *                   destination projection.
- *
- *   Example :  $projarray[0] = "proj=lcc";
- *              $projarray[1] = "ellps=GRS80";
- *              $projarray[2] = "lat_0=49";
- *              $projarray[3] = "lon_0=-95";
- *              $projarray[4] = "lat_1=49";
- *              $projarray[5] = "lat_2=77";
- *              $projarray[6] = "";
- *
- *              $pjlcc = pj_init($projarray);
- *              $projarray2[0] = "proj=latlong";
- *              $pjlat = pj_init($projarray2);
- *
- *              $ingeox = 1537490.335842;
- *              $ingeoy = -181633.471555;
- *
- *              $ret = pj_transform($pjlcc, $pjlat, $ingeox, $ingeoy);
- *
- * 5) pj_free : frees PJ structure
- *
- *  void pj_free(PJ pj);
- *
- **********************************************************************/
-
-#ifdef USE_PROJ
-#include <projects.h>
-#include "php_mapscript_util.h"
-
-#include "php.h"
-#include "php_globals.h"
-
-#include "maperror.h"
-
-#include <time.h>
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#include <process.h>
-#else
-#include <errno.h>
-#endif
-
-#define ZEND_DEBUG 0
-
-#ifndef DLEXPORT
-#define DLEXPORT ZEND_DLEXPORT
-#endif
-
-#define PHP_PROJ_VERSION "1.0.000 (Nov. 1, 2000)"
-
-/*=====================================================================
- *                         Prototypes
- *====================================================================*/
-DLEXPORT void php_proj_pj_init(INTERNAL_FUNCTION_PARAMETERS);
-DLEXPORT void php_proj_pj_fwd(INTERNAL_FUNCTION_PARAMETERS);
-DLEXPORT void php_proj_pj_inv(INTERNAL_FUNCTION_PARAMETERS);
-DLEXPORT void php_proj_pj_transform(INTERNAL_FUNCTION_PARAMETERS);
-DLEXPORT void php_proj_pj_datum_transform(INTERNAL_FUNCTION_PARAMETERS);
-DLEXPORT void php_proj_pj_free(INTERNAL_FUNCTION_PARAMETERS);
-
-
-DLEXPORT void php_info_proj(void);
-DLEXPORT int  php_init_proj(INIT_FUNC_ARGS);
-DLEXPORT int  php_end_proj(SHUTDOWN_FUNC_ARGS);
-
-DLEXPORT void ttt(INTERNAL_FUNCTION_PARAMETERS);
-
-#ifdef ZEND_VERSION
-PHP_MINFO_FUNCTION(phpproj);
-#else
-DLEXPORT void php_info_proj(void);
-#endif
-
-static zend_class_entry *proj_class_entry_ptr;
-
-#define PHPMS_GLOBAL(a) a
-static int le_projobj;
-
-function_entry php_proj_functions[] = {
-  {"pj_fwd",  php_proj_pj_fwd,   NULL},
-  {"pj_inv",  php_proj_pj_inv,   NULL},
-  {"pj_init",  php_proj_pj_init,   NULL},
-  {"pj_transform",  php_proj_pj_transform,   NULL},
-  {"pj_datum_transform",  php_proj_pj_datum_transform,   NULL},
-  {"pj_free",  php_proj_pj_free,   NULL},
-  {NULL, NULL, NULL}
-};
-
-
-php3_module_entry php_proj_module_entry = {
-#if ZEND_MODULE_API_NO >= 20010901
-  STANDARD_MODULE_HEADER,
-#endif
-  "PHPPROJ", php_proj_functions, php_init_proj, php_end_proj,
-  NULL, NULL,
-#ifdef ZEND_VERSION
-  PHP_MINFO(phpproj),
-#else
-  php_info_proj,
-#endif
-#if ZEND_MODULE_API_NO >= 20010901
-  "phpproj, php4.1version",          /* extension version number (string) */
-#endif
-  STANDARD_MODULE_PROPERTIES
-};
-
-
-#if COMPILE_DL
-DLEXPORT php3_module_entry *get_module(void)
-{
-  return &php_proj_module_entry;
-}
-#endif
-
-
-function_entry php_proj_class_functions[] = {
-  {"ttt",             ttt,        NULL},
-  {NULL, NULL, NULL}
-};
-
-DLEXPORT void ttt(INTERNAL_FUNCTION_PARAMETERS)
-{
-}
-
-#ifdef ZEND_VERSION
-PHP_MINFO_FUNCTION(phpproj)
-#else
-DLEXPORT void php_info_proj(void)
-#endif
-{
-  php3_printf(" Version %s<br>\n", PHP_PROJ_VERSION);
-
-  php3_printf("<BR>\n");
-}
-
-DLEXPORT int php_init_proj(INIT_FUNC_ARGS)
-{
-  zend_class_entry tmp_class_entry;
-
-  PHPMS_GLOBAL(le_projobj)  =
-    register_list_destructors(php_proj_pj_free,
-                              NULL);
-
-  INIT_CLASS_ENTRY(tmp_class_entry, "proj", php_proj_class_functions);
-  proj_class_entry_ptr = zend_register_internal_class(&tmp_class_entry TSRMLS_CC);
-
-  return SUCCESS;
-}
-
-DLEXPORT int php_end_proj(SHUTDOWN_FUNC_ARGS)
-{
-  return SUCCESS;
-}
-
-
-#if !defined  DEG_TO_RAD
-#define DEG_TO_RAD      0.0174532925199432958
-#endif
-
-#if !defined RAD_TO_DEG
-#define RAD_TO_DEG  57.29577951308232
-#endif
-
-/**********************************************************************
- *                       _php_proj_build_proj_object
- **********************************************************************/
-static long _php_proj_build_proj_object(PJ *pj,
-                                        HashTable *list, pval *return_value TSRMLS_DC)
-{
-  int pj_id;
-
-  if (pj == NULL)
-    return 0;
-
-  pj_id = php3_list_insert(pj, PHPMS_GLOBAL(le_projobj));
-
-  _phpms_object_init(return_value, pj_id, php_proj_class_functions,
-                     PHP4_CLASS_ENTRY(proj_class_entry_ptr) TSRMLS_CC);
-
-  return pj_id;
-}
-
-
-/************************************************************************/
-/*       DLEXPORT void php_proj_pj_init(INTERNAL_FUNCTION_PARAMETERS)   */
-/*                                                                      */
-/*      Creates and initialize a  PJ structure that can be used with    */
-/*      proj_fwd and proj_inv function.                                 */
-/*                                                                      */
-/*       Parameter :                                                    */
-/*                                                                      */
-/*          array : array of parameters                                 */
-/*                                                                      */
-/*       Ex :                                                           */
-/*                                                                      */
-/*              $projarray[0] = "proj=lcc";                             */
-/*              $projarray[1] = "ellps=GRS80";                          */
-/*              $projarray[2] = "lat_0=49";                             */
-/*              $projarray[3] = "lon_0=-95";                            */
-/*              $projarray[4] = "lat_1=49";                             */
-/*              $projarray[5] = "lat_2=77";                             */
-/*                                                                      */
-/*              $pj = pj_init($projarray);                              */
-/*                                                                      */
-/************************************************************************/
-DLEXPORT void php_proj_pj_init(INTERNAL_FUNCTION_PARAMETERS)
-{
-  pval        *pArrayOfParams = NULL;
-
-  pval        **pParam = NULL;
-  HashTable   *list=NULL;
-
-  int         nParamCount = 0;
-  int         i = 0;
-  PJ          *pj = NULL;
-
-  char        **papszBuf = NULL;
-
-//    char        *strttt = NULL;
-//    int         ttt;
-
-  //ttt = strlen(strttt);
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 1, &pArrayOfParams) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  if (pArrayOfParams->type == IS_ARRAY)
-    nParamCount = _php3_hash_num_elements(pArrayOfParams->value.ht);
-  else
-    nParamCount = 0;
-
-  if (nParamCount <= 0)
-    RETURN_LONG(-1);
-
-  papszBuf = (char **) malloc((nParamCount+2)*sizeof(char *));
-
-  for (i = 0; i < nParamCount; i++) {
-    if (_php3_hash_index_find(pArrayOfParams->value.ht, i,
-                              (void **)&pParam) != FAILURE) {
-      convert_to_string((*pParam));
-      if ((*pParam)->value.str.val != NULL)
-        papszBuf[i] = msStrdup((*pParam)->value.str.val);
-    }
-  }
-  papszBuf[i] = NULL;
-
-  pj = pj_init(nParamCount, papszBuf);
-
-  _php_proj_build_proj_object(pj, list, return_value TSRMLS_CC);
-}
-
-
-/************************************************************************/
-/*       DLEXPORT void php_proj_pj_fwd(INTERNAL_FUNCTION_PARAMETERS)    */
-/*                                                                      */
-/*       Performs a projection from lat/long coordinates to             */
-/*      cartesian coordinates (projection defines in the pj parameter)  */
-/*      Parameters :                                                    */
-/*                                                                      */
-/*         - double p1 : latitude (in decimal degree )                  */
-/*         - double p2 : longitude (in decimal degree )                 */
-/*         - PJ pj : valid projection structure (see pj_init)           */
-/*                                                                      */
-/*       Ex :                                                           */
-/*              $lat = 45.25;                                           */
-/*              $lon = -75.42;                                          */
-/*                                                                      */
-/*              $ret = pj_fwd($lat, $lon, $pj);                         */
-/*              printf("geo x = %f<br>\n", $ret["u"]);                  */
-/*              printf("geo y = %f<br>\n",$ret["v"]);                   */
-/*                                                                      */
-/************************************************************************/
-DLEXPORT void php_proj_pj_fwd(INTERNAL_FUNCTION_PARAMETERS)
-{
-  HashTable   *list=NULL;
-  pval        *p1, *p2;
-  pval        *pj = NULL;
-  PJ          *popj = NULL;
-  projUV      pnt;
-  projUV      pntReturn = {0,0};
-
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 3, &p1, &p2, &pj) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  /* -------------------------------------------------------------------- */
-  /*      initilize return array.                                         */
-  /* -------------------------------------------------------------------- */
-  array_init(return_value);
-
-  convert_to_double(p1);
-  convert_to_double(p2);
-
-  popj = (PJ *)_phpms_fetch_handle(pj,
-                                   PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  if (popj) {
-    pnt.u = p2->value.dval * DEG_TO_RAD;
-    pnt.v = p1->value.dval * DEG_TO_RAD;
-
-    pntReturn = pj_fwd(pnt, popj);
-  }
-
-  add_assoc_double(return_value, "u", pntReturn.u);
-  add_assoc_double(return_value, "v", pntReturn.v);
-}
-
-
-/************************************************************************/
-/*       DLEXPORT void php_proj_pj_inv(INTERNAL_FUNCTION_PARAMETERS)    */
-/*                                                                      */
-/*       Performs a projection from cartesian  coordinates              */
-/*      (projection defines in the pj parameter) to lat/long            */
-/*      coordinates.                                                    */
-/*                                                                      */
-/*       Return vales are in decimal degrees.                           */
-/*                                                                      */
-/*       Parameters :                                                   */
-/*                                                                      */
-/*               - double p1 : projected coordinates (x)                */
-/*               - double p2 : projected coordinates (y)                */
-/*               - PJ pj : valid projection structure (see pj_init)     */
-/*                                                                      */
-/*         Ex :                                                         */
-/*              $ingeox = 1537490.335842;                               */
-/*              $ingeoy = -181633.471555;                               */
-/*                                                                      */
-/*              $ret = pj_inv($ingeox, $ingeoy, $pj);                   */
-/*                                                                      */
-/*              printf("latitude = %f<br>\n", $ret["u"]);               */
-/*              printf("longitude = %f<br>\n",$ret["v"]);               */
-/************************************************************************/
-DLEXPORT void php_proj_pj_inv(INTERNAL_FUNCTION_PARAMETERS)
-{
-  HashTable   *list=NULL;
-  pval        *p1, *p2;
-  pval        *pj = NULL;
-  PJ          *popj = NULL;
-  projUV      pnt;
-  projUV      pntReturn = {0,0};
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 3, &p1, &p2, &pj) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  /* -------------------------------------------------------------------- */
-  /*      initilize return array.                                         */
-  /* -------------------------------------------------------------------- */
-  array_init(return_value);
-
-  convert_to_double(p1);
-  convert_to_double(p2);
-
-  popj = (PJ *)_phpms_fetch_handle(pj,
-                                   PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  if (popj) {
-    pnt.u = p1->value.dval;
-    pnt.v = p2->value.dval;
-
-    pntReturn = pj_inv(pnt, popj);
-    pntReturn.u *= RAD_TO_DEG;
-    pntReturn.v *= RAD_TO_DEG;
-  }
-
-  add_assoc_double(return_value, "u", pntReturn.v);
-  add_assoc_double(return_value, "v", pntReturn.u);
-}
-
-/************************************************************************/
-/*    DLEXPORT void php_proj_pj_transform(INTERNAL_FUNCTION_PARAMETERS) */
-/*                                                                      */
-/*       Transform coordinates from source projection to destination    */
-/*      projection.                                                     */
-/*                                                                      */
-/*       Parameters :                                                   */
-/*                                                                      */
-/*         - PJ *srcdefn,                                               */
-/*         - PJ *dstdefn,                                               */
-/*         - double x                                                   */
-/*         - double y                                                   */
-/*                                                                      */
-/************************************************************************/
-DLEXPORT void php_proj_pj_transform(INTERNAL_FUNCTION_PARAMETERS)
-{
-  HashTable   *list=NULL;
-  pval        *p1, *p2;
-  pval        *pjin, *pjout = NULL;
-  PJ          *in = NULL;
-  PJ          *out = NULL;
-  projUV      pnt = {0, 0};
-  double      z = 0;
-  int         error = -1;
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 4, &pjin , &pjout, &p1, &p2) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  /* -------------------------------------------------------------------- */
-  /*      initilize return array.                                         */
-  /* -------------------------------------------------------------------- */
-  array_init(return_value);
-
-  convert_to_double(p1);
-  convert_to_double(p2);
-
-  in = (PJ *)_phpms_fetch_handle(pjin,
-                                 PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  out = (PJ *)_phpms_fetch_handle(pjout,
-                                  PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  if (in && out) {
-    pnt.u = p1->value.dval;
-    pnt.v = p2->value.dval;
-
-    if( pj_is_latlong(in) ) {
-      pnt.u *= DEG_TO_RAD;
-      pnt.v *= DEG_TO_RAD;
-    }
-
-    error = pj_transform(in, out, 1, 0,
-                         &(pnt.u), &(pnt.v), &z );
-
-    if( pj_is_latlong(out) ) {
-      pnt.u *= RAD_TO_DEG;
-      pnt.v *= RAD_TO_DEG;
-    }
-  }
-
-  if (error) {
-    php_error(E_ERROR,"Error in pj_transform");
-
-    RETURN_LONG(-1);
-  } else {
-    add_assoc_double(return_value, "u", pnt.u);
-    add_assoc_double(return_value, "v", pnt.v);
-  }
-}
-
-
-
-/************************************************************************/
-/*                                 DLEXPORT                             */
-/*      void php_proj_pj_datum_transform(INTERNAL_FUNCTION_PARAMETERS)  */
-/*                                                                      */
-/*         Datum from source projection to destination                  */
-/*        projection.                                                   */
-/*                                                                      */
-/*         Parameters :                                                 */
-/*                                                                      */
-/*           - PJ *srcdefn,                                             */
-/*           - PJ *dstdefn,                                             */
-/*           - double x                                                 */
-/*           - double y                                                 */
-/*                                                                      */
-/************************************************************************/
-DLEXPORT void php_proj_pj_datum_transform(INTERNAL_FUNCTION_PARAMETERS)
-{
-  HashTable   *list=NULL;
-  pval        *p1, *p2;
-  pval        *pjin, *pjout = NULL;
-  PJ          *in = NULL;
-  PJ          *out = NULL;
-  projUV      pnt = {0, 0};
-  double      z = 0;
-  int         error = -1;
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 4, &pjin , &pjout, &p1, &p2) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  /* -------------------------------------------------------------------- */
-  /*      initilize return array.                                         */
-  /* -------------------------------------------------------------------- */
-  array_init(return_value);
-
-  convert_to_double(p1);
-  convert_to_double(p2);
-
-  in = (PJ *)_phpms_fetch_handle(pjin,
-                                 PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  out = (PJ *)_phpms_fetch_handle(pjout,
-                                  PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  if (in && out) {
-    pnt.u = p1->value.dval;
-    pnt.v = p2->value.dval;
-
-    if( pj_is_latlong(in) ) {
-      pnt.u *= DEG_TO_RAD;
-      pnt.v *= DEG_TO_RAD;
-    }
-
-    error = pj_transform(in, out, 1, 0,
-                         &(pnt.u), &(pnt.v), &z );
-
-    if (!error) {
-      if( pj_is_latlong(out) ) {
-        pnt.u *= RAD_TO_DEG;
-        pnt.v *= RAD_TO_DEG;
-      }
-    }
-  }
-
-  if (error) {
-    php_error(E_ERROR,"Error in pj_datum_transform");
-
-    RETURN_LONG(-1);
-  } else {
-    add_assoc_double(return_value, "u", pnt.u);
-    add_assoc_double(return_value, "v", pnt.v);
-  }
-}
-
-/************************************************************************/
-/*       DLEXPORT void php_proj_pj_free(INTERNAL_FUNCTION_PARAMETERS)   */
-/************************************************************************/
-DLEXPORT void php_proj_pj_free(INTERNAL_FUNCTION_PARAMETERS)
-{
-
-  /* ==================================================================== */
-  /*      TODO : freeing does not work properly on PHP4.                  */
-  /* ==================================================================== */
-#ifdef PHP4_BAD_FREEING
-
-  HashTable   *list=NULL;
-  pval        *pj = NULL;
-  PJ          *popj = NULL;
-  /* -------------------------------------------------------------------- */
-  /*      extract parameters.                                             */
-  /* -------------------------------------------------------------------- */
-  if (getParameters(ht, 1, &pj) != SUCCESS) {
-    WRONG_PARAM_COUNT;
-  }
-
-  popj = (PJ *)_phpms_fetch_handle(pj,
-                                   PHPMS_GLOBAL(le_projobj), list TSRMLS_CC);
-
-  if (popj) {
-    pj_free(popj);
-  }
-#endif
-}
-
-#endif /* USE_PROJ */
-
-
-


=====================================
mapscript/phpng/CMakeLists.txt
=====================================
@@ -22,17 +22,17 @@ add_definitions(-DZTS=1)
 endif(WITH_THREAD_SAFETY)
 endif(WIN32)
 
-include_directories(${PHP_FOUND_INCLUDE_PATH})
-include_directories(${PHP_FOUND_INCLUDE_PATH}/main)
-include_directories(${PHP_FOUND_INCLUDE_PATH}/Zend)
-include_directories(${PHP_FOUND_INCLUDE_PATH}/TSRM)
+include_directories(${PHP_INCLUDE_PATH})
+include_directories(${PHP_INCLUDE_PATH}/main)
+include_directories(${PHP_INCLUDE_PATH}/Zend)
+include_directories(${PHP_INCLUDE_PATH}/TSRM)
 
 include_directories(${PROJECT_SOURCE_DIR}/mapscript/swiginc)
 include_directories(${PROJECT_SOURCE_DIR}/mapscript/)
 include_directories(${PROJECT_SOURCE_DIR}/mapscript/phpng)
 
 if(WIN32)
-include_directories(${PHP_FOUND_INCLUDE_PATH}/win32)
+include_directories(${PHP_INCLUDE_PATH}/win32)
 endif(WIN32)
 
 IF(PHP_VERSION LESS 5)
@@ -56,4 +56,4 @@ target_link_libraries(php_mapscriptng mapserver)
 set_target_properties(${SWIG_MODULE_mapscript_REAL_NAME} PROPERTIES PREFIX "")
 if(NOT WIN32)
 install(TARGETS php_mapscriptng DESTINATION ${PHP_EXTENSION_DIR})
-endif()
\ No newline at end of file
+endif()


=====================================
mapscript/python/examples/project_csv.py
=====================================
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 """
 Simple example to read a csv file and reproject point x/y data
 


=====================================
mapscript/python/examples/shpdump.py
=====================================
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 """
 Dump the contents of the passed in Shapefile
 


=====================================
mapscript/python/examples/shpinfo.py
=====================================
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 """
 Extracts basic descriptive information from a Shapefile
 


=====================================
mapscript/python/examples/wxs.py
=====================================
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 """
 Output WMS GetCapabilities response for a Mapfile
 


=====================================
mapscript/swiginc/image.i
=====================================
@@ -1,24 +1,24 @@
 /* ===========================================================================
    $Id$
- 
+
    Project:  MapServer
    Purpose:  SWIG interface file for mapscript imageObj extensions
-   Author:   Steve Lime 
+   Author:   Steve Lime
              Sean Gillies, sgillies at frii.com
-             
+
    ===========================================================================
    Copyright (c) 1996-2001 Regents of the University of Minnesota.
-   
+
    Permission is hereby granted, free of charge, to any person obtaining a
    copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following conditions:
- 
+
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
- 
+
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -29,7 +29,7 @@
    =========================================================================*/
 
 %extend imageObj {
-   
+
     /* imageObj constructor now takes filename as an optional argument. */
     imageObj(int width, int height, outputFormatObj *input_format=NULL,
              const char *file=NULL,
@@ -55,19 +55,30 @@
         }
 
         if (file) {
-            
+
             renderer = format->vtable;
             rb = (rasterBufferObj*) malloc(sizeof(rasterBufferObj));
             if (!rb) {
                 msSetError(MS_MEMERR, NULL, "imageObj()");
                 return NULL;
             }
-            if ( (renderer->loadImageFromFile((char *)file, rb)) == MS_FAILURE)
+            if ( (renderer->loadImageFromFile((char *)file, rb)) == MS_FAILURE) {
+                msFreeRasterBuffer(rb);
+                free(rb);
                 return NULL;
-
-            image = msImageCreate(rb->width, rb->height, format, NULL, NULL, 
+            }
+            image = msImageCreate(rb->width, rb->height, format, NULL, NULL,
                                   resolution, defresolution, NULL);
-            renderer->mergeRasterBuffer(image, rb, 1.0, 0, 0, 0, 0, rb->width, rb->height);
+            if (! image) {
+                msFreeRasterBuffer(rb);
+                free(rb);
+                return NULL;
+            }
+
+            if(renderer->mergeRasterBuffer(image, rb, 1.0, 0, 0, 0, 0, rb->width, rb->height) != MS_SUCCESS) {
+                msFreeImage(image);
+                image = NULL;
+            }
 
             msFreeRasterBuffer(rb);
             free(rb);
@@ -79,13 +90,13 @@
         return image;
     }
 
-    ~imageObj() 
+    ~imageObj()
     {
-        msFreeImage(self);    
+        msFreeImage(self);
     }
 
-    /* saveGeo - see Bugzilla issue 549 */ 
-    void save(char *filename, mapObj *map=NULL) 
+    /* saveGeo - see Bugzilla issue 549 */
+    void save(char *filename, mapObj *map=NULL)
     {
         msSaveImage(map, self, filename );
     }
@@ -119,7 +130,8 @@
         else
         {
             msSetError(MS_IMGERR, "Writing of %s format not implemented",
-                       "imageObj::write");
+                       "imageObj::write",
+                       self->format->name);
         }
 
         return retval;
@@ -136,15 +148,15 @@
     contributed by Jerry Pisk, jerry.pisk at gmail.com
     -------------------------------------------------------------------------
     */
-    
-    gdBuffer getBytes() 
+
+    gdBuffer getBytes()
     {
         gdBuffer buffer;
-        
+
         buffer.owns_data = MS_TRUE;
-        
+
         buffer.data = msSaveImageBuffer(self, &buffer.size, self->format);
-            
+
         if( buffer.data == NULL || buffer.size == 0 )
         {
             buffer.data = NULL;
@@ -157,16 +169,16 @@
 
     int getSize() {
         gdBuffer buffer;
-	int size=0;
-        
+        int size=0;
+
         buffer.data = msSaveImageBuffer(self, &buffer.size, self->format);
-	size = buffer.size;
-            
+        size = buffer.size;
+
         if( buffer.data == NULL || buffer.size == 0 ) {
             buffer.data = NULL;
             msSetError(MS_MISCERR, "Failed to get image buffer size", "getSize");
         }
-	free(buffer.data);
+        free(buffer.data);
         return size;
     }
 }


=====================================
mapscript/swiginc/msio.i
=====================================
@@ -45,10 +45,8 @@ void msIO_stripStdoutBufferContentHeaders(void);
 const char *msIO_getStdoutBufferString(void);
 gdBuffer msIO_getStdoutBufferBytes(void);
 
-#ifdef SWIGPYTHON
 %newobject msIO_getAndStripStdoutBufferMimeHeaders;
 hashTableObj* msIO_getAndStripStdoutBufferMimeHeaders(void);
-#endif
 
 %{
 


=====================================
maptemplate.c
=====================================
@@ -3671,7 +3671,9 @@ static char *processLine(mapservObj *mapserv, char *instr, FILE *stream, int mod
     strlcat(repstr, " ", sizeof(repstr));
   }
   msStringTrimBlanks(repstr);
-  outstr = msReplaceSubstring(outstr, "[layers]", repstr);
+  encodedstr = msEncodeHTMLEntities(repstr);
+  outstr = msReplaceSubstring(outstr, "[layers]", encodedstr);
+  free(encodedstr);
 
   encodedstr = msEncodeUrl(repstr);
   outstr = msReplaceSubstring(outstr, "[layers_esc]", encodedstr);



View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/commit/e33994355f3ff96efbf8989cc4e970589b20c435

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/mapserver/commit/e33994355f3ff96efbf8989cc4e970589b20c435
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190418/65eb68d9/attachment-0001.html>


More information about the Pkg-grass-devel mailing list