Opened 19 years ago

Closed 19 years ago

#1454 closed defect (fixed)

PHP Mapscript FATAL ERROR: Call to undefined method ms_layer_obj::removeClass()

Reported by: ale.pas@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.6
Severity: major Keywords:
Cc:

Description

Hi,
Here running
$ /var/www/cgi-bin/mapserv -v
MapServer version 4.6.0-beta3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER 
SUPPORTS=WFS_CLIENT INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL 
INPUT=SHAPEFILE

$ /usr/bin/php -v
PHP 5.0.4 (cgi-fcgi) (built: Aug 30 2005 14:25:17)

I have a mapscript routine like this:

-----8<-------------------------------------

  $layer=$map->getLayerByName($layername);
  if($layer->connectiontype == MS_POSTGIS){
    $searchstring = $searchfield . ' ~* \'' . $searchstring .'\'  ';
  } else {  // Shapefile
    $numclasses = $layer->numclasses;
    // HACK: Remove all classes except one: otherwise only first class is queryied
    // If anybody knows a better way... please let me know
    for($i = 1 ; $i < $numclasses; $i++){
       // This produces a fatal: Call to undefined method
ms_layer_obj::removeClass()
       // $layer->removeClass();
    }
    $searchstring = '/' . strtoupper($searchstring) . '/';
  }

-----8<-------------------------------------

The layer object exists and is correctedly instanciated with numclasses = 4 
but I've got the am error on (now commented) line
// $layer->removeClass();

Is this a bug or something wrong with my installation?

Change History (1)

comment:1 by dmorissette, 19 years ago

Resolution: fixed
Status: newclosed
See bug 1373: $layer->removeClass() was added after 4.6.0-beta3, please try
upgrading to V4.6.1
Note: See TracTickets for help on using tickets.