[mapserver-users] Strage behaviour of dynamic classes (color v/s outlinecolor)

Daniel Morissette morissette at dmsolutions.ca
Tue Jan 29 18:22:29 EST 2002


Vinko Vrsalovic wrote:
> 
> BTW, is there no easy way to check for this at the library level?
> (say: "wrong value passed to set" at line X)
> 

Yes and no.  Since there are not really any strong data types in PHP,
doing strong type validation would create other annoying side effects.

A numeric value can sometimes be stored in a string variable, this will
happen when you get a numeric value via a form parameter for instance. 
So what we chose to do internally is to automagically convert the
parameters that we receive to the data type that we expect... that was
also the simplest way to do things.

That's why all the following calls will work:
  $layer->set("type", MS_LAYER_LINE);
or
  $layer->set("type", 1);
or 
  $layer->set("type", "1");
or even
  $layer->set("type", 1.000);

and for the same reason the following call won't do exactly what you
want and it won't produce an error message either:
  $layer->set("type", "MS_LAYER_LINE");

The only function parameters for which we do strong data type validation
are objects... and the reason is obvious in this case.

I guess stronger type checking for obvious cases like the one you ran
into wouldn't hurt... you may want to file an enhancement request in
bugzilla about that.
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.



More information about the mapserver-users mailing list