Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102946 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31748 invoked from network); 22 Jul 2018 00:05:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2018 00:05:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=levim@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.167.44 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.167.44 mail-lf1-f44.google.com Received: from [209.85.167.44] ([209.85.167.44:45600] helo=mail-lf1-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/E9-47674-65AC35B5 for ; Sat, 21 Jul 2018 20:05:44 -0400 Received: by mail-lf1-f44.google.com with SMTP id j143-v6so4066207lfj.12 for ; Sat, 21 Jul 2018 17:05:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=6aMQbp40u715w9JkjZLdqrjKCjX/Jf0qKYag4sPUIZQ=; b=qXBgXCGwmOkj0nZSBbrkJ4QrU54ONkvS8L1lhRWW8HKE+OTpt4+0vSeC2XY/CD34uY L17PzId9ug+wZkRYVVfMATJ9/E1x+wHK4TAqKMQDxYA6pPaGblOfUz5jGLw/lVyclEzC e40GZCBgtFVcBsGc75Ot/u6EJ2vy0MjoLeA/LoFrrnbeu+3H/BtDkD+etyYsBzOUCtqa zH4Gpn7OORnR+suYjrkrMhxOe25dX++0TEAGvvCooWMkT8oUPEeej9HmvR08gzDwnLhM Pw6b3+nsaiFdhsijUF440x8ZKo1d7hYmptbkUMrsYKdywqE/H4bF/LQqAjYpTh7OGc1U 8EZA== X-Gm-Message-State: AOUpUlGdv/T63yRQpr9/UxWcbjRcRkH2SOPtvixWLUd6A4VYLOEq5oQ4 xH/KW+a8ZRQXT+4mcvI1HgclKM+5V8OrKAaYrbA4XWl3 X-Google-Smtp-Source: AAOMgpe7KHE3x6r8CcGGo1ltbB19gUVN8KYaMfPHBsgZnDtE6xq2PIYaQJngbjgd8c8FB8zcZYajsHN+oGTBv8+BQo8= X-Received: by 2002:a19:2043:: with SMTP id g64-v6mr1735279lfg.66.1532217938838; Sat, 21 Jul 2018 17:05:38 -0700 (PDT) MIME-Version: 1.0 Date: Sat, 21 Jul 2018 18:05:22 -0600 Message-ID: To: internals Content-Type: text/plain; charset="UTF-8" Subject: Implementation ideas for adding early warning for mis-use of "parent"? From: levim@php.net (Levi Morrison) This code the illustrates the issue; it has no errors or warnings: ```php class A { function m(): parent { return $this; } } ``` However, if you run the method you will get an error. I want to add a light warning such as E_STRICT or E_DEPRECATED at compile time. Using CG(active_class_entry)->parent will not work at compile time, so that strategy is out. Given that `zend_compile_func_decl` is not called directly from `zend_compile_class_decl` it would be difficult to pass the parent's name in any way other than a compiler global. Is there anything in particular I need to do if I add another compiler global? I intend to set and unset it in `zend_compile_class_decl`. Anyone have a better way to pass around the parent's name at compile time?