2008/5/14 Christian Schneider <[EMAIL PROTECTED]>: > > Am 14.05.2008 um 02:06 schrieb Marcus Boerger: >>> >>> So you are saying that >>> $o_Foo->bar = array(42); >>> is ok when the class "expects" a string but >>> unset($o_Foo->bar); >>> or (as as slight variation) >>> $o->Foo->bar = null; >>> is not? >> >> I Do not get the connection here? And since when can we 'expect' a string >> only for a property? > > You stated that allowing unset() is a bug. I replied that unset() is not > different from setting the value to array(42) or null and should be allowed. > > Apropos 'expect': A programmer of a class can have some expectations of what > is stored in attributes, PHP does not enforce these expectations (hence I > put expect in quotes). And just to make it clear: I want to keep it that > way, I do not want PHP to become more strict than it is. > > So I completely agree with Stas here. > > - Chris
Chris (and others). _IF_ the property was defined in an interface, should "unset" be "allowed" to remove the property? The current behaviour of allowing a property of a normal class to be removed is debatable. (It is currently doing so, so for BC it should probably stay as such). With the interface though, we _are_ saying we want to enforce its existence, so it must always exist and as such unset() would/should have no meaning and be an error (attempting to change an enforced interface structure). Maybe this is a difference for E_STRICT? Richard. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php