I executed this example and object comparison returned true on clone call.<br>But it returned false when I request another reference from same layer from getLayer.<br>Should not it return true ?<br><br><br>#/* 09/04/2010 test for mapserver object comparison on PHP.<br>
# If I clone a layer object from a map instance and compare the cloned with ref, do they are the same ?<br># Answer: yes.<br># PHP state: Two object instances are equal if they have the same attributes and values, and are instances of the same class<br>
#require_once dirname( __FILE__ ).'/class/mapfile/Mapfile.php';<br>#Mapfile::checkLibrary();<br><br>$map = ms_newMapObj( '' );<br>var_dump( $map->numlayers );<br>$l = ms_newlayerobj( $map );<br>var_dump( $map->numlayers );<br>
print( nl2br( "\n" ) );<br>$l->set( 'type', MS_LAYER_POLYGON );<br>#var_dump( $l->type );<br>$lClone = clone $l;<br>var_dump( __LINE__, ( $l == $lClone ) );<br>var_dump( __LINE__, ( $l == $map->getLayer( 0 ) ) );<br>
$lRef = $map->getLayer( 0 );<br>var_dump( __LINE__, ( $l == $lRef ), $l->type, $lRef->type );<br><br>#repeated test but now with $l from the reference from getLayer<br>print( nl2br( "\n" ) );<br>$l = $map->getLayer( 0 );<br>
$lClone = clone $l;<br>var_dump( __LINE__, ( $l == $lClone ) );<br>var_dump( __LINE__, ( $l == $map->getLayer( 0 ) ) );<br>$lRef = $map->getLayer( 0 );<br>var_dump( __LINE__, ( $l == $lRef ), $l->type, $lRef->type );<br>
<br>exit;<br>