Opened 20 years ago

Closed 20 years ago

#672 closed defect (fixed)

[PHP MapScript] Object names conflict with ChartDirector

Reported by: dmorissette Owned by: mapserverbugs
Priority: high Milestone: 4.4 release
Component: MapScript-PHP Version: 4.2
Severity: normal Keywords:
Cc: sgillies@…

Description

Rodrigues, Joseph wrote:
> Hi,
> I am posting this to all developers to alert you of a know conflict with
> a php package known as Chartdirector.  This is a commercial product that
> is for charting graphs in php and although it is commercial, it is
> freely available to use with 100% functionality.
> 
> The known problem:
>  Chartdirector has a Class called 'Line' and 'Layer' and causes a
> conflict with php as phpmapscript has classes with the same name.  The
> result is neither works without changing the one class name.
> 
> I use Mapserver with phpmapscript to build charts on the fly and graph
> them using Chartdirector.  I want to suggest a name change to MSLine and
> MSLayer or anything else of your choice to differentiate from such
> generic names as Line and Layer.  I made a similar suggestion to Peter
> Kwan of Chartdirector.
> 
> http://www.advsofteng.com/
> 
> Thank you
> Joseph Rodrigues
>

Change History (7)

comment:1 by dmorissette, 20 years ago

Milestone: 4.4 release
Perhaps we could rename the objects to use the MapServer names: lineObj and
layerObj.  Let's review that for the 4.3/4.4 release.

comment:2 by sgillies@…, 20 years ago

These types of conflicts are usually resolved by using fully qualified
names

   ChartDirector::Layer
   mapscript::Layer

Yes?  It's perfectly fine for different packages to have similarly
named classes, and I bet that ChartDirector wasn't the first to
have Layer and Line.

BTW, I didn't know php-mapscript had Layer and Line, I thought it was
already layerObj and lineObj.

comment:3 by dmorissette, 20 years ago

The actual internal PHP object names are not really used at the moment, so what
they are doesn't matter.

comment:4 by sgillies@…, 20 years ago

Ah, now that I did a bit of reading about PHP 4 and PHP 5
I understand that PHP 4 has no namespaces!  Ugh ... how do
you work around this?  

IMO, "Line" doesn't adequate describe the class anyway.  
"PolyLine" is a much more accurate name.  But our PolyLine
can also transform itself between projections.  In an OO
language module, Geometry::PolyLine would synopsize every
capability of the class.  For PHP 4, maybe PolyLineGeometry?



comment:5 by dmorissette, 20 years ago

Status: newassigned
Since the names are not used anyway, I am simply thinking of solving the issue
by faking the namespace concept using a prefix + underscore, e.g.  ms_lineObj or
mapscript_lineObj.

I don't think it would be smart to invent new names for the classes at this
point. PolyLine may not be uninque anyway and another software may be using it.
 OTOH mapscript_lineObj has much more chances of being unique.

comment:6 by sgillies@…, 20 years ago

OK, now I understand what you mean when you say the names aren't being
used ... because you have a different constructor.  However you want 
to resolve it is fine with me.  mapscript_lineObj would probably be
the closest to a PHP 5 mapscript::lineObj?

comment:7 by dmorissette, 20 years ago

Resolution: fixed
Status: assignedclosed
Looking into the code I see that this was fixed already a year ago in v4.0 (so
this problem would happen only with v3.6 or older):

----------------
 * Revision 1.160  2003/04/23 19:13:29  dan
 * Use class names in the format ms_<classname>_obj for PHP class entry
 * definitions.  (We were getting name collisions with the "error" class.)
----------------

Note: See TracTickets for help on using tickets.