Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113415 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4363 invoked from network); 7 Mar 2021 17:29:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Mar 2021 17:29:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8B0081804E2 for ; Sun, 7 Mar 2021 09:21:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 7 Mar 2021 09:21:16 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id h4so12025803ljl.0 for ; Sun, 07 Mar 2021 09:21:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=bsOqiTfWam7yNutjwcHmCJ8JqqnVESWNmHh4eIptiOk=; b=V3Dz8KrFyukWSikQdKwPcOI95uE0ypStDmSBc2Xwxz1OyfcoX6FpOgNRUF/Rqya/0a Qu9Dq104e+DOANElHYuKO2c8bCTn1y98mYKRdPmgVHHLcn7fqSxSF9tsQNlMQfJyVWJS 4sgwwVV+FRrIzNWK7qpxgLxKqSNOAI7YTPxzKfBWHzTFMplfL8tVYznYDMYNnROjjlaE wK08YnzWHpVccqnSjbOBPTz8sQ8VNEro/UKJUIqP6ZNnp4F/rAVydQe5HChzPi74qjWj X56VtdeYSHf1sRUbrm3JxxYlCtj//1BPi4dJpBJlYlzpbpHl/+dJ5R+EBDMjCWXyDamW vkJg== 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=bsOqiTfWam7yNutjwcHmCJ8JqqnVESWNmHh4eIptiOk=; b=q6d4R0+OqNC0NzLmsxDSwu6dTi4TJkHcRhTAYi6rd7PIb6MZx2Z8okhDece/Nypnyo er1uhGzAZPg3r4OdKtnVAEMs/9Y5QlPR/vQsxKUBeyQC490eplRsDH7JcsMwpNQ4u9QC KyMToFQaxRNtdC0624HFXvRuWoKddbiTbGizZZe5vHILy8nBNOr4R/XPFUzR2H8l+wTq tuS3zok8MrLetzSH11wcf7ZrKhH/yEVp6607KxldiaVL5YBfxmvUW6HfZY15zO0Jp362 mnGzoAAiutRE6lmfM8fNh8WtcpaebgeUBlVDMNGXAG8Wmi4Fcnz8dNtpXe2LMCCLB+4c nSRg== X-Gm-Message-State: AOAM5304uqP5xf3dtcI7EXC2s4v4ODXpZK4vFrIpYDG4t/9s0FCQ9959 l8BECBshNIHTPUw/pWDBATASoWmPiJNvvRQQkq3tN4D+nNI= X-Google-Smtp-Source: ABdhPJxq0ELEajTngWdIPZ4KiZw/rzxMiR+tI4Fvk7IrjliPp1L10ZV31u6erAmVOEW2jhLVFj59LHL6nTdgYab4bRc= X-Received: by 2002:a2e:91c2:: with SMTP id u2mr5898499ljg.301.1615137673220; Sun, 07 Mar 2021 09:21:13 -0800 (PST) MIME-Version: 1.0 Date: Sun, 7 Mar 2021 10:20:56 -0700 Message-ID: To: internals Content-Type: text/plain; charset="UTF-8" Subject: Storing the lcname of symbols From: morrison.levi@gmail.com (Levi Morrison) Hello! Most of PHP's symbols are case insensitive. This means extensions that need to do things with function and method names end up lowercasing and hashing the lowercased names, often having to do more memory allocations too. Since case insensitive symbols is language dictated behavior, it makes sense to expose the correctly cased symbols to extensions. In PHP 8.0 (and possibly older, I did not check), the engine is already interning the lowercased name of user defined functions; it's just not made available to extensions. In my ideal world, we'd actually switch all symbols to be case sensitive. However, that won't be happening for PHP 8 due to BC. So, instead, I propose adding an `.lcname` member (or some other name indicating it's been normalized to the preferred PHP case) to at least zend_op_array and zend_class_entry, but preferably for internal functions too. Note that many internal functions will already be lowercase, so the data can be shared. I could make this change in the main engine, but I strongly suspect it will not play correctly with opcache.