Opened 20 years ago

Closed 18 years ago

#617 closed defect (fixed)

PHP mapscript function querybyshape causes segmentation fault when querying any postGIS layer

Reported by: aaronkoning@… Owned by: dblasby@…
Priority: highest Milestone: 4.2 release
Component: MapScript-PHP Version: 4.0
Severity: major Keywords:
Cc:

Description

This problem is also described in the following two posts from other users:

  http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0205/msg00273.html
  http://lists.gis.umn.edu/pipermail/mapserver-users/2004-April/011627.html

A querybyshape() works on shapefiles and then with the exact same dataset loaded
into postgis, the querybyshape() causes a segmentation fault. VERY strangely, if
you perform a $shapeObj->draw($map, $layer, $image); prior to the queryByShape,
it stops the segmentation fault from occuring. Still it fails to find
records/features, wheras the querybyshape on the shapefile did. The dataset I am
using is the bcmj_bc cities dataset from BC (which was converted to shp and
postGIS formats from e00):
  ftp://ftp.elp.gov.bc.ca/dist/arcwhse/2million/bcmj_bc.zip

Basically it doesn't seem to matter what your mapfile looks like and whether you
get the polygon shape from a shapefile or create it with add(); and line objects.

SETUP:
  MapServer: 4.0.1
  PostGIS: 0.8
  PHP: 4.3.4

------------------------
Aaron

Change History (7)

comment:1 by dmorissette, 20 years ago

Cc: mapserver-bugs@… pramsey@… added
Milestone: 4.2 release
Owner: changed from mapserverbugs to dblasby@…
Dave, Paul, any chance that you could look at this bug before the freeze for the
4.2 release Friday?  

You probably don't need PHP MapScript to reproduce since it doesn't do anything
special. It is quite likely that any MapScript would do the same, maybe even the
CGI. If you really can't reproduce it then please reassign to me and I'll try to
have a look.

comment:2 by dblasby@…, 20 years ago

I'm currently trying to reproduce this.  Anyone have a stack trace?

comment:3 by dmorissette, 20 years ago

Any update on this?  Were you able to reproduce?

comment:4 by bill@…, 19 years ago

I believe this might be fixed by the regex solution (we were seeing this during
our testing, and it stopped after the regex fixed).  Perhaps it could be
retested under 4.6b2?

Bill

comment:5 by dmorissette, 19 years ago

What makes you think it was related to the regex problem? I'd love to be able to
say that this is fixed, but I don't see any evidence that they were using PHP's
regex. The configure script should have made it nearly impossible to compile
with the php regex at that time.

Anyway, a couple of query-related issues have been fixed since this was
reported. Aaron, can you please try this again with the latest 4.6 beta and let
us know if the problem is still present?

comment:6 by fportaneri.ext@…, 19 years ago

Hi all,

FYI, I just had the same bug using MapServer 4.4.1 and 4.4.2, PostGIS 0.9.1 
and 1.0.0, and PHP 5.0.3. My ms_GetVersion() returns:

MapServer version 4.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT 
SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT INPUT=EPPL7 INPUT=JPEG INPUT=POSTGIS 
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

The queryByShape() does a segmentation fault when it finds records in the 
query area, and just warns "Warning: [MapServer Error]: msQueryByShape(): No 
matching record(s) found" (without segmentation fault) if nothing is found in 
the area. 

The good news is that I just rebuild MapServer4.6.0-rc1 under my environment 
and it works fine now, results are returned and no segmentation fault occurs. 
The ms_GetVersion() shows:
Version = MapServer version 4.6.0-rc1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG 
OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=THREADS 
INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Hope it helps.
Franck

comment:7 by harsha.mo@…, 18 years ago

Resolution: fixed
Status: newclosed
this is message
Note: See TracTickets for help on using tickets.