Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91253 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73562 invoked from network); 17 Feb 2016 17:47:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2016 17:47:03 -0000 Authentication-Results: pb1.pair.com header.from=kelerest123@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kelerest123@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.177 as permitted sender) X-PHP-List-Original-Sender: kelerest123@gmail.com X-Host-Fingerprint: 209.85.214.177 mail-ob0-f177.google.com Received: from [209.85.214.177] ([209.85.214.177:34869] helo=mail-ob0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/DB-17120-712B4C65 for ; Wed, 17 Feb 2016 12:47:03 -0500 Received: by mail-ob0-f177.google.com with SMTP id xk3so25880263obc.2 for ; Wed, 17 Feb 2016 09:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=1V74ef5h8UrjcSrgCNFZmFvRg8JkMKIY3tfW2j6bupE=; b=zGWhJEpEGReT1Sz5hHtE0EAtngM7arlKXwgDFqAXSbhTbe5YippN+NEo7UaKOS7GoH hdqikRztrrkOfCyOcpM3d6rym6Dyj4OMfnaXnXr5tHxxFQYn2E3yeeqrmkZpnUqeO0te iZtlW+iuGlOgCd544h1oi55qdsnI2gyFbbWBBQEsXXvesQBojQJqJef/72r0fT0IcH5X zxzWiCtlg4EXk+nEqZ97L5PhajhmlH6tMTGntgiTpBtojXto9ml9fX+fhUzYLS6XOOXh GLCg6dN6ITPO8BF6XkfitNXoPzxF3S7OpKNl36f1yhPYdfIx9Bam4n8WB/Bz+vi0UINz uknw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=1V74ef5h8UrjcSrgCNFZmFvRg8JkMKIY3tfW2j6bupE=; b=OH9K5hRAgGlIhw5y9UKiqRNMpXRned/Ur4y6F0Qhu+eb9Sr0Q9ndl0rRBlUTsJ3uW9 X5fHRPRjRL5/WWJxrQNwZkE7D7342W2UBSqwojj0miNIooPsFsrkqeHI3ffjQ6C+8ge8 Bp0HRLQ779+y/9A1DJ9uKq8EJunDfgEl3hwsp7cK3pJLS3oT+doN100p78lN5YRfpgGW P6L6+pmBi7kiyeawlJ16dRqNINPlEGFhqgkGSgtwOOchMe8JkEJtFTEFMKfyw9zRLIjE c85jQ+gLSpK2cb4GjXmkuyJ1y0YydJmjeb6CHlBd4UJhZd6v6BlpmWeTwca8OP9oglSU cbWw== X-Gm-Message-State: AG10YOQV6AYBAhTAP3/9X5dX+nSP86VIcH+q3B01dv4kI1KRHQEfk2IYdHdsVjGcvEeWp7b+TEMCWfxwFmnk9Q== X-Received: by 10.182.20.238 with SMTP id q14mr2206849obe.33.1455731220755; Wed, 17 Feb 2016 09:47:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.73.195 with HTTP; Wed, 17 Feb 2016 09:46:41 -0800 (PST) Date: Wed, 17 Feb 2016 23:16:41 +0530 Message-ID: To: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Class constants on object references have variable-inconsistent accessibility From: kelerest123@gmail.com (=?UTF-8?B?SmFrdWIgS3Viw63EjWVr?=) Dear internals! I have encountered an inconsistence, or rather a bug, in PHP's syntax. The thing is, in PHP you can access constants defined on a class using reference to an instance of this class, stored in variable. So we have a code: Which will nicely pass. But things will go wrong having a code trying to access the same constant on an object of B stored in member variable of class A -- let's see below: b = new B; var_dump($a->b::C === B::C); // Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM) in... ?> Let me conclude that if there's access to class' constant using a reference to an instance of the class, it should be possible with any type of value-holder (so-called variable). -- Cheers, Kubis