Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130427 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 99F0A1A00BC for ; Tue, 24 Mar 2026 11:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1774350292; bh=hODxXAFjgmnJnCiLv8NpC2UJUv9vMABdWFoIqunQ93U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jZkCfX8crLgm5SynKY9TfxcY5FQgXmet94ef/fpV4Derh7kv+FSU2dN/b8Isp5Emt cMCB7dWZOlgJP8WA46wKLZ71rGqKNUpTShL7+co262uaf0MGBZ2QpHmi6fyCin4mkT Mm8OLozrHYNILa4tvvq92k/+n0kSw6AgJiqulTK22oE+nI/t0Q89I18OhNNsSb69Qx I/TIeEqNdu5EMaLULeMLjM8f/qme0Vf/XXckBDjAiTTv30NolBj88Ruvll27VglxcZ CsvfdfVLQeew2J7YgFC2P1p7fQo5p1ZInKt2+gBYtf01uFQtnLZHiDJ3loK0XgS9Bh 6ThG2J0ihuoRg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 50E921801DA for ; Tue, 24 Mar 2026 11:04:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 24 Mar 2026 11:04:48 +0000 (UTC) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-b9840bc8030so45080466b.1 for ; Tue, 24 Mar 2026 04:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774350282; cv=none; d=google.com; s=arc-20240605; b=eSbLV1cWCQAVRI0GiBk/R9H41ChluIpQFdrvBIbqQIiJBlhsnQQb1lebOwQymMiUrF xW8bBrCBEAhCjd95EMlEvp3Mw+yDAs2LrocMkNXLtJkPNkZokPuVPCCl2ghxik1cxSOh xiOI4+5iOrkxJtvURsrxShKif0r5Gw8d3V1WnoGGJlEaQ8W5MmWTkTL8Oq++mq+zXO8F /g9a5o85DK/0jD2jz5ani/hAs3cT9qxDxWBdouTJzLn94iVdpnqq9Yot/0aEkSiiZL0b ywim087FTuWgUUAVBQuUr5DJ9IE3yPNNJ2ZQ6UIasSq+GnbEhn9yU1T9Tl8aKhS7w0Wu v7NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=jFUwZyULiniGvBSKv6SxJAomHCGEOz8J+bD8vz7B4G8=; fh=IVJOKO8+dqusO1ftHvO6BQus2DxrSnSnbi+8m92NGD4=; b=KRvpNe8kGerZjhHwkoCpHBdzmIgVLJwcTjqJT6dCpYxLHYoZet2JeIGWFR4aUFkBk4 PmyUJzgAO2kd6+6IYSqfJxEgPyQRTJUrEKJHbs0JAUTnrYISNTNIWwQOkckTokaGNkQ1 HuxiAJlm0kkCnS2zNoWz5wYAP6lgbvJPnsX3/+Uni0LfjHm5zZ6zPuweHmW/PBbnoz3C W57dxZlUEIP1z3XExxCqE0LL97iN/4BBtiMsPSdKatVNW5JmHVI8BwWbOlH0M82JWIDy s4OH9Swpy4aXYoiBsvGj8G0WbnMCUic7R/325Ealj5Du5vHEee56p3ReUVOiEofdHNOt E98Q==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774350282; x=1774955082; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jFUwZyULiniGvBSKv6SxJAomHCGEOz8J+bD8vz7B4G8=; b=avJH9AdKEzEFaivXL5dJcOed3Fbtrp9yyarls+8Alg3qIptLOqv01fK7wf0XcdHVEP FGc7CUy/0ajGVaTGXs3GDWNOaQuzlotWmI3b5VKkeDk0pH1fYD2s+5D/xx80cy6a6+ii 6U2YYKIn22AtmELGWNx4EqMzcJZzXAlZcAOCRFQfzr47Tb2aTaE8/zIBvvO9hiURms+o OEnjSKC2Rq+wvrTpTYvCwed0cqZWHyjv6DKuXlK+gt5g03P0U+zvKq/TVcREF84I9mpu rwXlxjWktTAGRKkbhP45mRIvc6+f/MVDLaNW9aerTCc8IIWfhAAYvhqNmU4GLfWbcEy6 EsFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774350282; x=1774955082; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jFUwZyULiniGvBSKv6SxJAomHCGEOz8J+bD8vz7B4G8=; b=PHTV72OjHMEQQt0XwYN8jkB7GMo34ooIqROkTAzIrJur3bf0OS4z2MEuRHcAxWGwC+ mD+7JYzxAVEszSP4EbsSf9LyQHyb9eWyhmoBAtrMJ7Q62VJ8fyaLDJ9NiGw1zgbg9QB2 GuLd/Z+oYUCpHjRlyMyCV4KUPaHxuvHfv3HWb5UUOrfJCwtvoUWpuechh6WmJMx2U/ah ZOhtihCi5dRcjLHJS5qJCsAWzD8dE/LhMgyB37j/gbdKyU/adE8hqxE1gJzDfR78FRmx hAZlto7tWY09K6+BdK50Vt+VfLq0C1ysYJrS69WclHWvWPPbuMAvk/Fomq3ynna53ysc Webg== X-Gm-Message-State: AOJu0Yz9BSBKXUEKoygdCI4dAQ4fLf0FIBBOlYVpxdRimKxaYumxN5dl bL1eFRqFmNZMxoO60JjcmJUSY01Tl2k9GvBSAASqceD7ar1Sr0tpqS0+2aDoV37oaCsV+uQLZEA sjsdI2yoZxQJp0nQB/h+DSoEPZujXtsc= X-Gm-Gg: ATEYQzw3Qm5YF+KOzX+vN8Y99xAUhpBdnJt3IarbsjYFz3G0HCIu7gSWxYehvcOWk1p PjwOyfwCkhlehOu1n86pO3PQil6wreQbevQ3CazspPer3qJEnhC7e2vxShuvzsTSHp57BNYIvqy FQmUkBFuw9bixvSEc193zQiSaL2QuUcrAKftiYqAcRfMMeM6PJbMsnq5A51u0akCyUZY3JYYD77 HW8uSydAjFI9xgAy4U/VnuvY/1+Zmto+0Di/hKgJy/8zcHWwEf4OGGi61BXc9hBbnkA09RO3mXq 2RMb71Ob98HSafEiaj6vVjvE8sp/raf00nxW9eEA3aHdTN9z9PhxkN9nGuTAQ+5dEKzjMh1HkkS 5QB7R X-Received: by 2002:a17:907:2da1:b0:b97:3316:c34a with SMTP id a640c23a62f3a-b982f504c59mr514468266b.6.1774350281334; Tue, 24 Mar 2026 04:04:41 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 24 Mar 2026 07:04:31 -0400 X-Gm-Features: AQROBzATzseYoQjK-khl8SEqPE7GrAmArUa7OjfdMXIpbbp4DKmwFL94rmyj6gM Message-ID: Subject: Re: [PHP-DEV] [RFC] Four Pragmatic Directions for PHP: Simplicity, Arrays, Performance, Concurrency To: Aleksander Machniak Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000039e2f2064dc31e7f" From: dliebner@gmail.com (Dan Liebner) --00000000000039e2f2064dc31e7f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I agree with this sentiment. My main gripe with PHP 8 is that undefined array key accesses trigger a warning. There is no solution to this that doesn't require destroying the readability of a legacy codebase or using some hacky global error handler. I think the direction should always have been this: undefined array key accesses should simply return null by default. To ensure data integrity in critical paths, a new language construct could be used: strict_access($arr['key']). This construct `strict_access` (similar to isset which is not a "real" function) would tell the compiler to emit a specialized opcode that triggers a warning if the key is missing. Maybe a shorthand like `$arr['key']!` could be used. This would give developers the best of both worlds: clean, 'script-style' code by default, and explicit, high-performance validation only where it's actually requested. - Dan On Tue, Mar 24, 2026 at 6:33=E2=80=AFAM Aleksander Machniak = wrote: > On 24.03.2026 11:08, =E6=B2=89=E9=BB=98=E9=A2=86=E5=9F=9F=E3=80=81 wrote: > > // Current > > $names =3D array_values(array_filter($users, fn($u) =3D> $u->active)); > > $first =3D count($names) > 0 ? $names[0] : null; > > Not the best example, as you can also do: > > $first =3D array_find($users, fn ($user) =3D> $user->active)?->name; > > There are some existing functions like array_column() and array_first() > that seems you didn't know existed. So, there's been some progress in > this territory too. > > -- > Aleksander Machniak > Kolab Groupware Developer [https://kolab.org] > Roundcube Webmail Developer [https://roundcube.net] > ---------------------------------------------------- > PGP: 19359DC1 # Blog: https://kolabian.wordpress.com > --00000000000039e2f2064dc31e7f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I agree with this sentiment.

My main gripe with PHP 8 is that undefined array key accesses trigger a wa= rning. There is no solution to this that doesn't require destroying the= readability of a legacy codebase or using some hacky global error handler.=

I think the direction should always have been thi= s: undefined array key accesses should simply return null by default.
=

To ensure data integrity in critical paths, a new langu= age construct could be=C2=A0used: strict_access($arr['key']). This = construct `strict_access` (similar to isset which is not a "real"= function) would tell the compiler to emit a specialized opcode that trigge= rs a warning if the key is missing. Maybe a shorthand like `$arr['key&#= 39;]!` could be used. This would give developers the best of both worlds: c= lean, 'script-style' code by default, and explicit, high-performanc= e validation only where it's actually requested.

- = Dan
On Tue, Mar 24, 2026 at 6:33=E2=80=AFAM Aleksander Machniak <alec@alec.pl> wrote:
<= /div>
On 24.03.2026 11:08,= =E6=B2=89=E9=BB=98=E9=A2=86=E5=9F=9F=E3=80=81 wrote:
> // Current
> $names =3D array_values(array_filter($users, fn($u) =3D> $u->act= ive));
> $first =3D count($names) > 0 ? $names[0] : null;

Not the best example, as you can also do:

$first =3D array_find($users, fn ($user) =3D> $user->active)?->nam= e;

There are some existing functions like array_column() and array_first() that seems you didn't know existed. So, there's been some progress = in
this territory too.

--
Aleksander Machniak
Kolab Groupware Developer=C2=A0 =C2=A0 =C2=A0 =C2=A0 [https://kolab.org]
Roundcube Webmail Developer=C2=A0 [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
--00000000000039e2f2064dc31e7f--