Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79350 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42526 invoked from network); 1 Dec 2014 19:24:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Dec 2014 19:24:27 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.172 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.172 mail-pd0-f172.google.com Received: from [209.85.192.172] ([209.85.192.172:54269] helo=mail-pd0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/91-32869-A60CC745 for ; Mon, 01 Dec 2014 14:24:26 -0500 Received: by mail-pd0-f172.google.com with SMTP id y13so11471179pdi.17 for ; Mon, 01 Dec 2014 11:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=iK6SSH5mx4ZiOevfbshqqC24/hokFQtTK+HBgjVWnq4=; b=iblKay8UQgAczcnySqJ+vx/mvIiyHlh48ykcANOEbZQV2bQXkTw6oA9fkEyZaC0bj8 zuMxs4Mssg5R7IhX/OHJYlE37qascOnkCG2Oo5nnECR0nOCStJI5bXcXzhgKaBLgEePj lYygQTWLjhW+9GdBgUdrz45UGSEsoYskeKF1ZntX7reAUeiYJ25u9bDXXLH+S+M0skEn 2vnrX1CwgFWYlfKumM6OOD75bBRm5Fhd5aAqtdpJ6QKqLlUfkHULWIUwBQQ2DuxAdd8B vpiFj4L990Pw+fAQcWExgCqPDTYC4MpRbma9YE5L91wRcGlad6MUid45XEZDemRKARm2 es5w== X-Received: by 10.70.140.229 with SMTP id rj5mr35823869pdb.60.1417461863473; Mon, 01 Dec 2014 11:24:23 -0800 (PST) Received: from stas-air.corp.wikimedia.org (tan4.corp.wikimedia.org. [198.73.209.4]) by mx.google.com with ESMTPSA id pn8sm18308042pdb.34.2014.12.01.11.24.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 11:24:22 -0800 (PST) Message-ID: <547CA49E.1030604@gmail.com> Date: Mon, 01 Dec 2014 09:25:50 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Carlos Rodrigues CC: internals@lists.php.net References: <5478FE5B.8050803@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Static functions Vs Nonstatic functions From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > class Cube { > function weird() { > echo Duck::foo(); > } > > } > > class Duck { > public function foo() { > echo 'My class is: ' . get_class($this); > } > } > > $rubik = new Cube; > $rubik->weird(); // Output: My class is: Cube This code produces: Deprecated: Non-static method Duck::foo() should not be called statically, assuming $this from incompatible context which informs you about the fact that what you're doing is wrong. This capability is kept for BC reasons. There was a discussion about dropping this from PHP 7 but it wasn't yet decided to remove the support. In any case, this has little to do with static and non-static functions having different namespaces. -- Stas Malyshev smalyshev@gmail.com