Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96151 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51598 invoked from network); 26 Sep 2016 10:48:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2016 10:48:52 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.22 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.22 mout.gmx.net Received: from [212.227.17.22] ([212.227.17.22:54284] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/20-11573-31DF8E75 for ; Mon, 26 Sep 2016 06:48:51 -0400 Received: from [192.168.2.103] ([79.243.115.246]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MDE6y-1biuV02qtg-00Gbwg; Mon, 26 Sep 2016 12:48:46 +0200 To: Dan Ackroyd , Pierre Joye References: Cc: PHP internals Message-ID: <81ee2c75-3183-40f3-0c04-90a723062f75@gmx.de> Date: Mon, 26 Sep 2016 12:49:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:ioken13rg5OvVKRZaroULTe97a8xzzjzg3GQG/05r30vEU1+63h 9GkjLIwq/awAF+o6OC4V94x9UppLBqCukdx092GRJl/D/fGAMzenh4DWh4FfL6g3zP3ndM2 xUyH24cc3DEASt22yxb5vFRXBIn+HDHC5dW5+QogpoFLKT4JHycEUOzDB+7k+vHVl4tginZ XvvBQJeNso+VglcTcDFRQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:R4elpnC20eQ=:eH/roM2f4hHbVlroqeGFF1 +LGX+SpNjzOcHnqo14HeTnLzFcIq8u0D/rqmyOv0ozWsxxHuY34W3E11qXm+rlJyYavDBnjg4 jsUCCYit50wS6RNunJYgROymIjNpA0q85eDYkoXpQYX7bKcYpzOc9CGckTyjMZ4cikJ67Fc6V 9DS5iVjiFupzHksdbD9XbJBgHOe/ZvKjtWyjuuFx+mBAx8PZHF4GkMvpMsJMr5dkXNw4zkkFn FE2lD9YtByjn1voozOKFv/0mR260xsy10ERRRrT5DsTJjDl4Uhmm6zCnb0vJwszux2gTzaRVA ItITj0pV/B6CaAOIdkx9WlE/chLArVQ7s5nsZ3k3kSqz3saVE0w80kPhipa7HBe8o4G32V1+k bpPcFKC/3pPmARpjmYJYmiDITRYGKrMK9oIqk/8XNchMRbuJRok+eaCEzabxNqJuyPQTc8pC4 W5CHwtGjHYiJSPnboB3Ui0QMvLqhx+/ZrNsfVujoyWPP6kr2vEagpNovW5cUnIv/Jndbx8tOU 7uwIVgmr0H8HDXuBwucZkgnVdTtJ9q3UTwsNsIvBWJaM1iKJwABqzKC4huiCJPREr++dwPF66 QEejioo8g4XpYDsMWVgKd7i4fzLswRblD89gDzcEnoA68CUHDiZ9tCWeJF8WA3ZiaRp7d9Myg YvrjI5GSATA1JNx5WvoWoU2OYbB68kaQ/ULwAl3cg4KnPye6SMoqtslf3ScAiwOgLUq5dWhCf uG5L5LLThIHBTF0tuQf8SujVsXIEGD4YDQgYqDpzqRvZ2T4B8Un9vSuLdahzGnDWXIdzykNa8 vqPCs1C Subject: Re: [PHP-DEV] [VOTE] get_class() disallow null parameter From: cmbecker69@gmx.de ("Christoph M. Becker") On 25.09.2016 at 14:20, Dan Ackroyd wrote: > On 25 September 2016 at 06:29, Pierre Joye wrote: > >> I am pretty sure it is by design (for what I can remember) > > I do not believe that is correct. > > The commit message* says: "Restore PHP-5.2 behaviour when passing null > inside object scope to get_class()" > > The commit does not restore the previous behaviour.** I'm pretty > certain it was just a mistake. Indeed, the commit message doesn't fit to the commit. However, that does not necessarily mean that the behavior was deliberately changed. See cataphract's explanation in : | The convention is to give internal functions that have optional | arguments a default value and have them behave the same way when the | default value is given and when the argument's not passed at all. IMHO, that's how it should be. Behaving otherwise would contradict the Principle of least astonishment. Perhaps we better should have two functions, say get_current_class(void) and get_class_of(object $object), and deprecate get_class(). > As Leigh noted, the behaviour is not clearly documented. In fact the > manual also says: "If get_class() is called with anything other than > an object, an E_WARNING level error is raised.". I'm pretty sure that > null is not an object, so this RFC actually moves the behaviour closer > to what the manual says. … but would contradict the changlog entry for PHP 5.3.0. -- Christoph M. Becker