queryByAttributes PHP/Mapscript issue
Rhys Ickeringill
rhysi at OMNILINK.COM.AU
Tue May 17 03:54:08 EDT 2005
Hi dev-list,
I'm attempting to do a pretty basic attribute search on a layer and am
getting MapServer crashes. Should I file this as a bug or am I just doing
something wrong?
Data config:
~~~~~~~~~
Postgres 7.4.7
PostGIS 1.0.0
PostGIS table 'parks' : CREATE TABLE parks ( ogc_fid integer NOT NULL,
wkb_geometry geometry, name character(50) )
System Config:
~~~~~~~~~~~
Linux (Slackware 10.1)
Apache 1.3.33
PHP 4.3.10 (running as Apache DSO)
MapServer 4.4.1 (runninng as PHP module)
My map file looks like this:
MAP "Map"
#
# Other layer definitions & map properties
#
LAYER
NAME "Parks"
TYPE polygon
CONNECTIONTYPE postgis
CONNECTION "dbname=mapdata"
DATA "wkb_geometry from parks using unique ogc_fid"
TEMPLATE "stub"
STATUS ON
PROJECTION
"prog=longlat"
"ellips=GRS80"
END
CLASS
NAME "Parks"
COLOR 0 160 0
END
END
#
# Other layer definitions...
#
END
The relevant PHP/MapScript code looks like this:
...
if( array_key_exists('FID', $_REQUEST ) ){
$fid = $_REQUEST['FID'];
$layer = $map->getLayerByName( 'Parks' ); // does this OK
$qryResult = $layer->queryByAttributes( 'ogc_fid', $fid , MS_SINGLE ) //
PHP processing dies here
if( $qryResult === MS_SUCCESS ){
// do stuff to highlight result and alter map extent (yet to be
tested - never gets that far)
...
I know it is the queryByAttributes() call which is causing the problem - if
I comment out the queryByAttributes() call, I get a pefectly drawn map with
the default [mapfile defined] extents.
If I remove the TEMPLATE from the layer definition above, I get the message:
[MapServer Error] msQueryByAttributes(): Requested layer has no templates
defined...
This means processing is getting down to line 283 or so of mapquery.c.
However I cannot find a way to raise the next error "No query expression
defined" (line 286) - for example
$layer->queryByAttributes( NULL, NULL, MS_SINGLE ).
mysteriously dies the same way as before, as also MapServer does if I
attempt to force the error "No matching record(s) found layer and area of
interest do not overlap" from line 333 by fiddling with my map's extent.
The only other information I have as to what is going wrong is found in the
Apache error log:
*** glibc detected *** double free or corruption (!prev): 0x[some memory
address] ***
[some timstamp] [notice] child pid 1234 exit signal Aborted (6)
Could there be an problem in the way parameters passed to PHP/MapScript are
transferred to MapServer? eg. something to do with 'zend_get_parameters()'
I'd like to offer more but I'm still way to new to PHP, Zend and MapServer.
If I can be of further assistance please let me know.
Regards,
Rhys
More information about the mapserver-dev
mailing list