Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121863 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34581 invoked from network); 29 Nov 2023 20:17:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Nov 2023 20:17:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8917818002B for ; Wed, 29 Nov 2023 12:17:26 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,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.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (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 ; Wed, 29 Nov 2023 12:17:26 -0800 (PST) Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-58d3c5126e9so134497eaf.1 for ; Wed, 29 Nov 2023 12:17:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701289037; x=1701893837; 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=utJ1dgFQDMHLcFTSgsqjaBupRmN+0GRbqmFDxruY600=; b=SXdrKECZPN5+dVztK1JTb72sM84Jghk5BPJZ59JvI0g5hC1FjuY1XE7+M+lfw19t37 e9vxJ9bXQ8PFNkyyCgNJ9X6vGRXeIp/w5EDWm1MdkSwBRSxovYZU4tBb7AHFWmrKwO8F UgHN+NZdH0KrJLrMryWCvin7cV82DnDvMCzsvmekKbP1Bgdpc+F9ZNEPH5lfJAB1qkOF gmd+zdJeMEbd4Ot9uUaLo9Dj6/mv/V0j+Y0r+O2qwlfXy8X10ofir/TlB4C/9pomtnVo Pq6DCOZLcPQ/kUSI9e5s5Q9VU3IA99ZxLvajjRGiR2wj/mD9UBCDcNizy2LJCBkcIMaD /5Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701289037; x=1701893837; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=utJ1dgFQDMHLcFTSgsqjaBupRmN+0GRbqmFDxruY600=; b=PKg8h7Dcp7ERD03PPuyw4/75tNpOsIh9XTJzdGPowt28Po8atHqbEC88ejFGrWGjjm SK1DHKpKuwyeW9/beVamOUAja0ddPFRT3fNtx56ALtUObgMueghHmi6mRnrNB7wxTtdE 5DD9EWF6FHpeFa6dFPwfFFrkgwvPX3i52eCYxhAy6hhvxP7sGacqoqsZX/OOJA/rLUVm 8+FCTon4zYi2DB4WCrfHW1tlRK3wZQj8SU1IpL7Xy3m3edQU8kJ0jiLByfg0qmVIFpXB 4mrEkeH5ijFgmHTm4hPZ77m3Fg827Niwpi40BbEGCQiNX83AD8kdmDIIRvXxIxpFeI1n pMGw== X-Gm-Message-State: AOJu0Yy8TmmOesE/MKZLLmaKagAV6G9BAkjTytjRbhgGGWRf1gRTNqvG ewduSi80dRB+9ARtFEjZO0vnI1nm8/d2sRIe2fh7Nv5/ X-Google-Smtp-Source: AGHT+IGDP4t3fE/QklmsU9N4PZruKO06Uvwl7o2Ibof3EZO1nHV1zJbvOlkOp+gwFforEO8QQQdLaeGyMse/4y9uLbk= X-Received: by 2002:a05:6820:220f:b0:57b:eee7:4a40 with SMTP id cj15-20020a056820220f00b0057beee74a40mr22509723oob.7.1701289037288; Wed, 29 Nov 2023 12:17:17 -0800 (PST) MIME-Version: 1.0 References: <6566989F.7010305@adviesenzo.nl> <34dada8e-7f2a-4d94-b7df-d9d3c7b2f3ce@app.fastmail.com> In-Reply-To: Date: Wed, 29 Nov 2023 20:17:06 +0000 Message-ID: To: Stephen Reay Cc: php internals Content-Type: multipart/alternative; boundary="000000000000ba5865060b503864" Subject: Re: [PHP-DEV] What is the prevailing sentiment about extract() and compact() ? From: davidgebler@gmail.com (David Gebler) --000000000000ba5865060b503864 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 29, 2023 at 7:19=E2=80=AFAM Stephen Reay wrote: > So no, I don't think compact() should be deprecated, what I think *should= * > happen, is to promote the current warning on undefined variables, to an > error, as per https://wiki.php.net/rfc/undefined_variable_error_promotion= . > Whether this is a foregone conclusion or not, I don't know because that R= FC > doesn't mention compact() specifically. > > I remember fixing a bug in compact where passing parameters which were not array or string were silently accepted - something I discovered when I was tracking down a bug in my code once and it turned out I'd accidentally done compact($x) instead of compact('x') - and that now gives a warning, consistent with the warning when variable names given are undefined. I don't want to see either compact or extract deprecated because I do use both (as do countless open source systems) and I don't think there is a reasonable justification for deprecating them. The behaviour of these functions is understood by static analysis tools, the alternatives are more verbose and more prone to developer error / mistakes from typos. I do agree with upping the error level in compact() from E_WARNING to E_ERROR and upping the warning on bad parameter types to a TypeError (which is what I'd originally pushed for), but I think these things should be a change to compact specifically, separate from any other RFC. -Dave --000000000000ba5865060b503864--