Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123270 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 qa.php.net (Postfix) with ESMTPS id 57C981A009C for ; Mon, 6 May 2024 18:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1715021105; bh=dxCd+88926icw9w1RQj6O2A9BXWtXU7IiKVFc8fbEL0=; h=From:Date:Subject:To:References:In-Reply-To:From; b=PIFl+Fk5AuJI9W3FDGY8r8WPFLMavxwpqCbqbKo0z6EoMs3e68VzUVZrstkeTgKp/ +Es92TrirQ2HJGgbczl7ipBlmbD0dCpBojxvZjP08Jo1Pwm8uamHHE1cz5NO+0gGHV BTzYxZrds3c+m58dobHXXPxh2E/C1OYsDZqymagkSy3iMOoXNrIFQ6Dsi73+w5JISl z54is/OYaDI6y9V4ahrPQRdBmILly4xBaT7KHDeN2uL7Ipu4z80Fwh0acFCeKdKISQ dXYwYEikXIVrzahoq3eWJ/UQPbBwK4feX4eyMHfKei71Hdl25wfPk3kvVL7UTgNF9k Y88jmf7gpmlsQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3EA8818064A for ; Mon, 6 May 2024 18:45:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-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,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 ; Mon, 6 May 2024 18:45:03 +0000 (UTC) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-41ba1ba55ebso16685605e9.1 for ; Mon, 06 May 2024 11:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wcflabs.de; s=google; t=1715021055; x=1715625855; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:user-agent:mime-version:date:message-id:from:from:to:cc :subject:date:message-id:reply-to; bh=oBRRwftLk+cCWO69jbb8IXX7+ztqUXWoC6VdEVtSMpI=; b=Uhy81LZ5++Wy8f0BVnPMUc4mChuQQzvHEdrd0Q9mcfGq2oqRGC9cG2UPEeMy4IxKI1 +GcLxRmbyDdyFAwReiA2GOLGf8RavSQpcO3dKe6sLY+91SGvUAhl9+h/wP8RUPz01Etj JL67SwJQvHx6mctlx7gwRuELzyy9BOfl9UAPTA94AXbwaB5SfO8EBlqA4+6PEhdO0dvk 2ZLRGbr4Vsw2sak0cViywVMR1JcCEKayRbs8Vr1O4IroGbFOrZAlib8nW/w2SMpqKNet nbmhuzdCkfUmqyH8LKNmrMV4DMGsa5lpaBC+XGHP+C0bTqmSgE1Le3/gOzHVfMA6bZ/A E0sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715021055; x=1715625855; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oBRRwftLk+cCWO69jbb8IXX7+ztqUXWoC6VdEVtSMpI=; b=hqG0dVB1ht2zCaoChFw0r2uMoN/de4v1vZ+Wzm+sSm+CqJ8UZeax85OJ4sLQCeUu86 wbhcButx9rgQtRr6JSVSgUrL5WO5xlXhFWTxKGNkFFPMsSLeLgXUIxskcUCHZREXTEhR agiymaIRFI3pXiKgE1T9zfttkO3TBMHOz//mupZYJn6F5AY5LaAVs+hvFclzjao/RRrd jHtRmbqs2jgoY1Cg4NsnbNYwsh8vo0CttkDBbGw2Irb9RvvueaF5oSDeZfy8BkXPIhJE bOdtMpq2DL89Tyio0hzDwxUvc+Yh24xAcXuYrgoK9HuhgjTGZbhzv98Mr9sSdzdlTRd/ xagQ== X-Gm-Message-State: AOJu0YwgcittTPZAEOntZRl4Fd8PIzAai3nWJA7ickEK7yPnDYF1mk6x p5HeE7pZGh1MxJm5htzSWH2r/RmiFECIUW1CujTe3Z8knBwoLOuMlj08/X5/GU9ThCnD0DozOsW / X-Google-Smtp-Source: AGHT+IHMidsy/qs7JwPaNUTSzkPCcv8U6/4ayWGqWvqmeVmkBQJD2onL4etmOPlBjj5OivE7WBM1DA== X-Received: by 2002:a05:600c:a09:b0:41c:190:2ba9 with SMTP id z9-20020a05600c0a0900b0041c01902ba9mr9784612wmp.31.1715021054619; Mon, 06 May 2024 11:44:14 -0700 (PDT) Received: from ?IPV6:2a01:598:a029:331e:8091:7c3a:dde2:9d3f? ([2a01:598:a029:331e:8091:7c3a:dde2:9d3f]) by smtp.gmail.com with ESMTPSA id j12-20020a05600c190c00b0041c120dd345sm16932149wmq.21.2024.05.06.11.44.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 May 2024 11:44:14 -0700 (PDT) X-Google-Original-From: =?UTF-8?Q?Joshua_R=C3=BCsweg?= Message-ID: <49aa8581-ed2e-4aa3-b330-7cd5d8efa764@wcflabs.de> Date: Mon, 6 May 2024 20:44:12 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC [Discussion]: array_find To: PHP internals References: <24e4529d-0b75-44de-90ef-34de5dfb1c99@wcflabs.de> <278889be-82ab-4827-a9e7-801b5ba2d8f8@app.fastmail.com> <06373f2b-5de0-4582-96c5-29c3b474c01d@wcflabs.de> <45e6365b-4963-4969-8cc1-80bae6922fc8@wcflabs.de> <60bb55a5-16c9-4df0-8521-75f82d3dbf5b@app.fastmail.com> <41ad56d9-8b27-420e-ba85-a3e9a6122bcf@wcflabs.de> <7a77288e-ddb7-436e-8981-b8b2508e1547@app.fastmail.com> Content-Language: de-DE In-Reply-To: <7a77288e-ddb7-436e-8981-b8b2508e1547@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: josh@wcflabs.de ("=?UTF-8?Q?Joshua_R=C3=BCsweg?=") Hi On 02.05.24 15:27, Larry Garfield wrote: > It's not just that it errors confusingly. It's that the design as is would be incompatible with any C-based function. A function that works with anything *except* the standard library seems... problematic. > > It's possible that, since these new functions are C-based, we could do some extra detection to see if the function is unary or not, and pass only the value if it is. I don't know if that is possible to do performantly in C, but it's definitely more of an option than if they were in user-space. (Again, I don't know if this is the best solution, but it seems like a possible solution.) I definitely get your point. However, there are not many standard functions that can be used there. The only functions I can think of that can be used there are `is_*` and maybe `strlen` (which has not a bool return type). I don't think that any internal functions are realistically passed there, but rather user-defined ones. I would therefore not make the function any more complicated than it already is. If the function works differently with internal functions than with user functions, this can also be very confusing for users. Your suggestion in particular doesn't really solve the problem. This is because the problem would still exist with the intval function, for example. Two parameters are then also passed there, although the second one makes little to no sense there. And to decide for each function whether it makes sense or not … The error message that too many parameters are passed is clear enough in my opinion. This is something that developers have to learn once (like many other things) and then the problem is solved. And even better, the problem is detected beforehand by a static analysis tool. Cheers Josh