I've sent it to Lassosoft already, but thought the list archives might benefit from a 'heads-up' on a bug that bit me this afternoon involving inheritance, custom types and overloading onDeserialise (it's a ctype that's stored in a session variable, hence the deserialise).
When a ctype is deserialised into a var it seems to break the parent/child inheritance 'context' of the ctype. This means that the child type's member tags that should overload the parent's member tags are effectively unavailable.
Test case below.
James Harvard
<?LassoScript
define_type('type1');
local( 'msgs' = array );
define_tag('oncreate');
self->whoami;
/define_tag;
define_tag('whoami');
self->'msgs'->insert( 'This is a ' self->type );
/define_tag;
define_tag('membertag');
self->'msgs'->insert('type1->membertag');
/define_tag;
define_tag('ondeserialize');
self->'msgs'->insert('type1->ondeserialize');
self->membertag;
self->whoami;
/define_tag;
/define_type;
define_type( 'type2','type1' );
define_tag('membertag');
self->'msgs'->insert('type2->membertag');
/define_tag;
/define_type;
var( 'type2_normal' = type2 );
var('type2_deserialised')->deserialize( $type2_normal->serialize );
$type2_normal->ondeserialize;
encode_break( '$type2_normal:\n' + $type2_normal->'msgs'->join('\n') );
'<br />' * 2 ;
encode_break( '$type2_deserialised:\n' + $type2_deserialised->'msgs'->join('\n') );
/*
On Lasso 8.5.6 this returns:
$type2_normal:
This is a type2
type1->ondeserialize
type2->membertag
This is a type2
$type2_deserialised:
This is a type2
type1->ondeserialize
type1->membertag
This is a type1
*/
?>
--
This list is a free service of LassoSoft:
http://www.LassoSoft.com/Search the list archives:
http://www.ListSearch.com/Lasso/Browse/Manage your subscription:
http://www.ListSearch.com/Lasso/