Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21877 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44613 invoked by uid 1010); 16 Feb 2006 11:32:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44597 invoked from network); 16 Feb 2006 11:32:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Feb 2006 11:32:53 -0000 X-Host-Fingerprint: 195.190.153.92 mg002.armadahosting.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([195.190.153.92:62622] helo=mg002.armadahosting.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 3F/20-39287-5E264F34 for ; Thu, 16 Feb 2006 06:32:53 -0500 Received: from fangel.idg.dk (unknown [62.199.138.131]) by mg002.armadahosting.com (Postfix) with ESMTP id B64A779CDA for ; Thu, 16 Feb 2006 12:28:22 +0100 (CET) Received: by fangel.idg.dk (Postfix, from userid 1000) id 3BF6655375; Thu, 16 Feb 2006 12:32:49 +0100 (CET) Reply-To: fangel@nable.dk To: php internals User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Disposition: inline Date: Thu, 16 Feb 2006 12:32:48 +0100 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-ID: <200602161232.48780.fangel@nable.dk> Subject: Unexpected "silent" type-cast with initialized but un-set members From: fangel@nable.dk (Morten Fangel) Hi, Look at the following example: --- bar->baz = 'blah'; } } $foo = new Foo(); print_r($foo); ?> -- It results in: --- Foo Object ( [bar] => stdClass Object ( [baz] => blah ) ) --- Foo->bar is never declared as anything but "public" and is therefor "type-less" (is there a proper term for this?). As soon as I try to assign Foo->bar->baz, then Foo->bar is cast to an stdObject and the baz property is set. This is pretty much what you would expect, but IMHO this should generate an E_NOTICE because you are using a non-object as an object.. Is this just my opinion? Morten Fangel // fangel