[mapserver-users] Fwd: php mapscript bug when using getshape
Steve Lime
steve.lime@dnr.state.mn.us
Wed, 31 Jul 2002 09:38:52 -0500
Received: from mail.state.mn.us
(state.mn.us [156.99.125.109])
by co5.dnr.state.mn.us; Wed, 31 Jul 2002 09:01:55 -0500
Return-Path: <sylvain.pasche@epfl.ch>
Received: from lists.gis.umn.edu by mail.state.mn.us with ESMTP for steve.lime@dnr.state.mn.us; Wed, 31 Jul 2002 09:01:27 -0500
Received: from dimail.epfl.ch (dimail.epfl.ch [128.178.79.31])
by lists.gis.umn.edu (8.9.3+Sun/8.9.1) with ESMTP id JAA02354
for <mapserver-bugs@lists.gis.umn.edu>; Wed, 31 Jul 2002 09:02:15 -0500 (CDT)
Received: from in3sun3.epfl.ch (daemon@in3sun3.epfl.ch [128.178.164.18])
by dimail.epfl.ch (8.8.X/EPFL-8.1g) with ESMTP id QAA24825
for <mapserver-bugs@lists.gis.umn.edu>; Wed, 31 Jul 2002 16:01:24 +0200 (MET DST)
Received: (from sypasche@localhost)
by in3sun3.epfl.ch (8.11.6+Sun/EPFL-8.1a) id g6VE1Oo08537;
Wed, 31 Jul 2002 16:01:24 +0200 (MEST)
From: Sylvain Pasche <sylvain_pasche@yahoo.fr>
Message-Id: <15687.60852.145762.8367@in3sun3.epfl.ch>
Date: Wed, 31 Jul 2002 16:01:24 +0200
To: mapserver-bugs@lists.gis.umn.edu
Subject: php mapscript bug when using getshape
X-Mailer: VM 6.92 under 20.4 "Emerald" XEmacs Lucid
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
I had a discussion with some developers recently, about a bug using
getshape in php, but the thread ended without response.
When running the code below, mapserver segfaults.
The problem is caused by the fact that msquerybypoint closes the layer
upon completion. But php mapscript still has a reference on the
corresponding layer. So, when it make a getshape request with the
freed layer, as the shapefile is closed, it segfaults.
Uncommenting the following line prevents mapserver from segfaulting,
this is just to identify the problem.
line 929 in mapquery.c
//msLayerClose(lp);
Sylvain
PS: is this mail adress a mailing list, or just an alias ?
-----------------BEGIN testcase.php
dl("php_mapscript.so");
$Map =
ms_newMapObj("/home/sypasche/public_html/cartoserver/mapfiles/testcase/testcase.map");
$Map->setextent(530000.610972,76797.7871943,610002.242216,156799.418438);
$layer = $Map->getlayerbyname("cabanes");
$click_geo = ms_newPointObj();
$click_geo->setxy(558401.190064, 112598.517176);
$res = $layer->queryByPoint($click_geo, MS_MULTIPLE, -1);
print "num res " . $layer->getNumResults() . " <br />";
$cache = $layer->getResult(0);
var_dump($cache);
// here the cache contains shapeindex 2, tileindex -1
// using $num in getshape, produces:
// 2 -> segfault
// 50 -> Assertion failed, Could not set shape values: 0, 0
$num = 2;
if(1)
$shape = $layer->getShape(-1,
$num);
$map_img = $Map->draw();
$url = $map_img->saveWebImage(MS_PNG,0,0,60);
echo "<br /> <img src=\"http://localhost$url\" />";
---------------END testcase.php