Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114863 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53712 invoked from network); 14 Jun 2021 14:19:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jun 2021 14:19:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4E262180548 for ; Mon, 14 Jun 2021 07:35:18 -0700 (PDT) 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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, 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-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 ; Mon, 14 Jun 2021 07:35:17 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id p7so21523915lfg.4 for ; Mon, 14 Jun 2021 07:35:17 -0700 (PDT) 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=4eMYnw0PbnIpA36SYWfyPkfqOvwU+RJ5n1/85sUCjuc=; b=JqCnAaT7sHV0zzn22PJAvAlpP0t7PVRsxpSK7u6ORhx9PNZKhQiLJMWeKxzSxbpnpD Y8e/D9mN7eLC6XSfVkEncluMjcJCX+H5YjMWGpXWLkfCAPm60Usdwuw1+OEiQfXv347V uOEHQFpRWYsaYRUDk8u0M7BL2QeSILk2mQ4pfIq3OvGiG0p/UMnPMfkyQhpbd+iI3iYZ Di10XgyUO5EFqNr1QwrFAdVAa45HBZToAiDP2hf9trvv7uZ3YBHsK6MSAd/RNHDp0wOY aQVmRwlVYs3kCQkioarOZCPRb+rNLhGIkzeaTOteJRL/bXhdFinKS2RSFtOr7Noih1jj hHfQ== 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=4eMYnw0PbnIpA36SYWfyPkfqOvwU+RJ5n1/85sUCjuc=; b=DL9TA3dK4i2IoeVWpqeiGkDhbrveA2022lxCYLAldyx3Bew0J0VGRyogSNP2xwG3Wv thZS2IYDIoAa09pfi/54DK/K36z3Wg+jrsu5bsaaFV0lz6pNkLWvsgQH/TWxkmVzkSZa vGKiLh7BB7uFVTCwssk3/WDFhpNhX2m+QvUZaebjVv+OUnLxi8hNrj6wF8Q0Azo+ywFy 7855Yetr4MbkoeItqQsHz44mH4qxCnUrJEyFQiCNHC0VyDiquRiyxYjihtgnnxqo/Iir jiiliE/E5gt1AY/iiDE+V4JXcIWq2BTrb3eqdfboOn5d7940N8djZvK63OnjEWfXhFEl ugzw== X-Gm-Message-State: AOAM531C4AxImdzyozs48RUv1rHMcYpQonzmtxOY2JQijLijOQzY2Dvu DcDTfgGYNTjScUtFdkKEzs5n5sxXvMUO1ed91jkgOHxyfqJ1DQ== X-Google-Smtp-Source: ABdhPJxgVWMRtGUaqeSrpKbXZBwNnAaQInrmVujW+EpHUWnyskIcgTj4nTdcLD64viDd2F9zbL1hIgEVzM0zvAEtSXE= X-Received: by 2002:a05:6512:1292:: with SMTP id u18mr2157214lfs.638.1623681315658; Mon, 14 Jun 2021 07:35:15 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 14 Jun 2021 16:35:00 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000000c5dbd05c4bac437" Subject: Allow objects in define() From: nikita.ppv@gmail.com (Nikita Popov) --0000000000000c5dbd05c4bac437 Content-Type: text/plain; charset="UTF-8" Hi internals, With the introduction of enums, it's now possible for constants to hold objects. However, this works only when using the `const X = Y` syntax, not when using `define('X', Y)`, which still excludes objects. I've submitted https://github.com/php/php-src/pull/7149 to relax the restriction. This means that define() would accept everything apart from recursive arrays. An alternative here would be to allow define() to only accept enum objects in particular, but not other objects. I would prefer not to do that, as such a restriction would be rather arbitrary, now that the technical work to support objects has been done. (PS: Please keep the difference between mutability and interior mutability in mind.) Regards, Nikita --0000000000000c5dbd05c4bac437--