Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120947 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71564 invoked from network); 29 Aug 2023 15:49:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Aug 2023 15:49:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 48845180543 for ; Tue, 29 Aug 2023 08:49:05 -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=-2.1 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Aug 2023 08:49:04 -0700 (PDT) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-99bfcf4c814so594082766b.0 for ; Tue, 29 Aug 2023 08:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693324143; x=1693928943; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9sv9mSjAa+xXEbwbf0hlDmlkeDf8TT0isZCHH5Jb5Fc=; b=pNhM0WFnCAUhbenOG9XkrsTomD7D5rMTWM4+2mgU1oVyKH/9DqIcvJPDW4gYZMep5h fYRWHzQSdOpME4QiSUwgxsVxLoXnnjUsBqgNm/H0OPgP0rKd+mmqGPUclOsVfg/jjd4/ 8t4ix95w/99o+Qg2FMvAugF4BJ/HLFTIc7j9GaarVsKxSTU2n7RkWvkIsMz8//Yliiwe ZHAAXhGV8WA8AjyfJ9sduq6HoJFaM85MODBU1/ZqmrQlodyLpgFLEQn4s8y3cV5AMLbm 5hVdJtudaBr64N1qRPgafaF91OYT2vYWrZJ4dWqBC6UQKmybZ9rtnBQNYqSGfY2J7bw0 VjGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693324143; x=1693928943; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9sv9mSjAa+xXEbwbf0hlDmlkeDf8TT0isZCHH5Jb5Fc=; b=f1vq5XGwL8xZ8hVrBYHpyZ3zY2xruZiFCxtr1HiaaFF45GTgCgoBqEWJTD5CtTntBv cV9g4MnIRECfabcJQ6np6SeLWEUaKNG4uIuFJNEEkoPQ6hBcqpy6kSdHqANw3yW5slQQ WOdMIAi4jxHdCFs2ZyEy+7VLUIxh3BnQokhnRroB9FOyZKm/V1pdmhYF80FZlvHzwChb Rz47Njs1rfp/uoYNr5VUGD1tyHjgz+/lEdZTkJgOXUMDvItB+shuSB2P6tE0qMu/qoZj gA/dXvTvmvaNRzTZrqqxMuClvO8qdBKpDei3GKdo/eNGHxPjlBn1+CEHLJmywINcUy0x IBKg== X-Gm-Message-State: AOJu0Yz+/6VYYSZNDTsh2Bg1Az2zsyS5NowcSIcXMlUbKflcGlKpiqW+ 1XTXomKmOwCWgKlBgw25dZyFgshJ0+QZh270 X-Google-Smtp-Source: AGHT+IHHVUaqkFRLYKYuoqRQkuzOE7GGsT0m7mVfXZYhdLYyj13ZSgLdeh8vKAXCwQIb4+2IR/hOpw== X-Received: by 2002:a17:907:a070:b0:9a2:86a:f9b8 with SMTP id ia16-20020a170907a07000b009a2086af9b8mr12008040ejc.60.1693324142997; Tue, 29 Aug 2023 08:49:02 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id z3-20020a1709064e0300b009a19fa8d2e9sm6064107eju.206.2023.08.29.08.49.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2023 08:49:02 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) In-Reply-To: Date: Tue, 29 Aug 2023 17:48:51 +0200 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <5B8A7736-9A2A-47E1-B410-4D734DC75EBE@gmail.com> References: <4406C50C-18FF-4F20-BA7B-206E86610CCC@sakiot.com> <245BD1CC-7D54-4CBE-9640-5C8FF5225617@gmail.com> To: Saki Takamachi X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [PHP-DEV] Apply strict_types to internal functions From: claude.pache@gmail.com (Claude Pache) > Le 29 ao=C3=BBt 2023 =C3=A0 15:19, Saki Takamachi a = =C3=A9crit : >=20 >> Hi, >>=20 >> The larger issue is that higher-order functions do not inherit the = `strict_types` mode from its calling code, and this is not specific to = internal functions. >>=20 >> If you intend to change that for internal functions (with proper = deprecation period, of course), you might consider making such a = behaviour also possible for userland functions (probably using some = opt-in); so that future higher-order internal functions do not become = impossible to polyfill. >>=20 >> =E2=80=94Claude >=20 > Hi, thank you for confirming. >=20 > If you simply put the problem you pointed out in the code, would it be = something like this? > https://gist.github.com/SakiTakamachi/8292dbfe92a2029a6c7b506b12296b7d >=20 > Admittedly, I don't think this is intuitive either. That might not be intuitive to you, but it follows directly from the = specified semantics: whether a function is called in `strict_types` mode = or not, depends only on where the function is called. I personally doubt = that there is an easy way to adjust the rule in order to make it both = =E2=80=9Cintuitive=E2=80=9D and simple. >=20 > [...] >=20 > When considering the inheritance of strict_types, I think that it = should be an attribute that can be set in =E2=80=9Cphp.ini" instead of = being specified for each file. >=20 > What do you think? Beware that there are many third-party packages that have not opted for = `strict_types=3D1`; if you enable that mode globally, you might make = those packages malfunction. As I have just checked, among the packages I=E2=80=99ve installed via = composer, there are more packages that do not use `strict_types=3D1`, = than packages that use it. Among those that don=E2=80=99t use = `strict_types`, the following ones are fairly common: google/apiclient league/oauth2-client michelf/php-markdown microsoft/microsoft-graph phpmailer/phpmailer phpoffice/phpspreadsheet phpseclib/phpseclib =E2=80=94Claude