Ticket #1373 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

PHP Mapscript does not support layerObj->removeClass

Reported by: m.cave-ayland@… Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.6
Severity: normal Keywords:
Cc: sgillies@…

Description

Whilst doing more testing with Mapscript, I noticed that the
layerObj->removeClass method is missing while it is available in SWIG Mapscript.
I needed this in order to implement query maps with customised styles and so I
generated a patch which is attached to this bug report.

The API for layerObj->removeClass seems a little brain-dead in that instead of
returning MS_SUCCESS/MS_FAILURE, it returns a copy of the class that you have
just deleted(!). It seems strange to want a copy of something I have just asked
to be deleted, but I decided to match the API used by SWIG Mapscript by
returning the classObj - perhaps this should be revisited in the future.

Attachments

ms-layerobj-removeclass.patch Download (4.0 KB) - added by m.cave-ayland@… 8 years ago.
Patch to implement layerobj->removeclass in PHP Mapscript

Change History

Changed 8 years ago by m.cave-ayland@…

Patch to implement layerobj->removeclass in PHP Mapscript

Changed 8 years ago by sgillies@…

  • cc sgillies@… added
Mark, it could be that my API is brain-dead ... or it could be that we simply
write different classes of applications :P

classObj::removeClass() is sorta like using pop on an array or list. You are, of
course welcome to implement it any way you want for PHP.

Changed 8 years ago by dmorissette

  • status changed from new to assigned
Well, I also found it odd at first to return the class that was just removed,
wrapping and returning the deleted class sounds like a waste of resources for
something that's useful only in some classes of applications.

Anyway, we'll carry the same behavior in PHP so that we're as close as possible
to the SWIG API. 

Changed 8 years ago by dmorissette

  • status changed from assigned to closed
  • resolution set to fixed
Patch applied in CVS, will be in 4.6.0

Changed 8 years ago by m.cave-ayland@…

Hi Sean, thanks for the heads-up regarding the stack-based thinking behind the
classObj::removeClass() method - I guess that it's not that we write different
classes of applications, just that we do it with different languages :) As long
as PHP Mapscript can free the dangling reference (which I believe it can) then
that won't cause us too many problems.

Daniel, thanks for applying to CVS.
Note: See TracTickets for help on using tickets.