catching an error with php-mapscript

Steffen Köhler skoehler at BUSCHJENA.DE
Fri Jan 14 00:22:48 PST 2005


Hello php-mapscript users,

I have an tool to generate map-files. This map-file have sometimes two 
cases of errors.
The first kind (syntactic errors) can be found with analysing the 
$error->code variable after running $map=ms_newMapObj(filename).
For the second kind (semantic errors, for example an forgotten "using 
srid=-1" for an table not registered in geometry_columns) I hope I can 
catch the error in the same way after the method $map->draw().
But this results in an segmentation fault (command line) or an internal 
server error (browser), but not all the time, sometimes it works :-( 

<snip example php-mapscript for the second case>
<?php

dl('php_mapscript.so');
error_reporting(0);
$map=ms_newMapObj('mapdata/MAP_13520.map');
ms_resetErrorList();
$image=$map->draw();
$error=ms_getErrorObj();
while ($error && $error->code!=MS_NOERR)
{
   printf("   routine %s: %s\n",$error->routine,$error->message);
   $error=$error->next();
}
?>
</snip>

This will produce the following output starting with php tt.php. I see the 
error is correctly catched in $error.

<output>
Content-type: text/html
X-Powered-By: PHP/4.3.3

   routine msDrawMap(): Failed to draw layer named 'Knoten'.
Speicherzugriffsfehler
</output>

How can I catch the error generated by php-mapscript.

yours sincerely
Steffen Köhler



---------------------------------------------------------------------------
3Kon GmbH Informationstechnologie
Auftragsentwicklung
Fregestrasse 6/8
D-07747 Jena
Tel.: +49 3641/30 38-34
Fax.: +49 3641/30 38-20
www.buschjena.de



More information about the MapServer-users mailing list