Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21881 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82818 invoked by uid 1010); 16 Feb 2006 12:45:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82803 invoked from network); 16 Feb 2006 12:45:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2006 12:45:34 -0000 X-Host-Fingerprint: 194.109.193.120 unknown Linux 2.5 (sometimes 2.4) (4) Received: from ([194.109.193.120:59528] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 0A/32-03062-DE374F34 for ; Thu, 16 Feb 2006 07:45:33 -0500 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 7BDD91A2AA4; Thu, 16 Feb 2006 13:45:34 +0100 (CET) Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23892-18; Thu, 16 Feb 2006 13:45:25 +0100 (CET) Received: from [192.168.1.12] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id DBBAC1A2A5E; Thu, 16 Feb 2006 13:45:24 +0100 (CET) Message-ID: <43F473DF.1080509@iamjochem.com> Date: Thu, 16 Feb 2006 13:45:19 +0100 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: fangel@nable.dk Cc: Antony Dovgal , php internals References: <200602161232.48780.fangel@nable.dk> <43F4647B.9030506@zend.com> <200602161255.37040.fangel@nable.dk> In-Reply-To: <200602161255.37040.fangel@nable.dk> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at moulin.nl Subject: Re: [PHP-DEV] Unexpected "silent" type-cast with initialized but un-set members From: jochem@iamjochem.com (Jochem Maas) Morten Fangel wrote: > On Thursday 16 February 2006 12:39, Antony Dovgal wrote: > >>>$a->bar = 1; >>var_dump($a); >>?> >>This code is much simpler, huh? > > Yeah, I must have been blinded by the lights. It merely resembles > $foo['bar'] = 'baz'; > Where $foo is cast as an array without the need to do $foo = array(); first. > > So I guess there is no need for a notice when you apply the same "pattern" to > an object. if that is the logic being applied in the engine then one might to wonder why a function such as array_merge() was changed to emit a warning when any of it's arguments are not arrays (whereas sometime in the past it used to swallow [and I assume 'autocast'] whatever it was given without a hiccup). I have been told that such warnings as array_merge() now emits are for my own good (in not so many words I was told it was "to protect me from my stupid self"), if it's good for me when I use array_merge() why not when an object is created implicitly (as in the example above)? actually my preference would be to drop the warning in array_merge() in this case (it seems like a more php way of doing things, imo) I'm very interested to learn what people think about this kind of thing in general - and obviously if someone knows of material that explains the reasoning behind the percieved inconsistency/problem I'd be very grateful. tar, jochem