Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126092 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 562651A00BD for ; Sun, 1 Dec 2024 23:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1733096848; bh=DqtGGkZBqBPdYkmTV65RuJroRNsYeXhO13uWCmpAGoc=; h=References:In-Reply-To:From:Date:Subject:Cc:From; b=YF2BuNIbc2Ox62xhZxA8fwKtdN8v+vlPQzGKCOWM5XQomjLKGV/+NNSlCiJON8duh lYVO4PRiJ9kwJ3K/uiE8xIb2y2ormmPo1DPJ6GcCv2TprYGy25m/hl7EzDAqMyd3aQ q8hHMTlKYFRwgf5H7LSQoW2ewfDvDISMHmn1S6PiSpxsWdPgTpTmzsR4MlUHbIRRtB I5Mymwdf40tyIkamxqtVYuijSpU/kMc4wr8y9oPeb7KNkeimJatQgP7S4a9od61lX7 +xB7gJc6NKz0cZQhmy8//U41zq7+YDjhrbZUpchgQHECxv/usS4X8SoGO89NzFI9VQ EPDyQtFpLX0Pg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 663E8180072 for ; Sun, 1 Dec 2024 23:47:27 +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=3.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MALFORMED_FREEMAIL,MISSING_HEADERS,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-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 ; Sun, 1 Dec 2024 23:47:26 +0000 (UTC) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a9a0ec0a94fso490809866b.1 for ; Sun, 01 Dec 2024 15:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733097034; x=1733701834; darn=lists.php.net; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=AeL35E25CSdzRt6ed826Hwg537xq4Ku8UoukklIpWKk=; b=khsdSgvmlbaRZVwuZU+d65e94AkIsru7DvRyPFRkxfsRX6VmT6LT6mZhmYKxXlXnzH L3CUGT9mOtcGi/iSD4+0kVHTu9h/TtsZJLo+e4oXVw42kzsV6Uo+xtJoBODjgGlJESvh wzfDK2mWxH7p18VAmnxsCeISNE1Nctcmqsa1gKIJLCblp5Jt0XI/aSwJcwjbMSc8Vpev gJxOLvNkPzrZnG6UoTCtjCal9q7r2ml9xYHuzoIwuytcctEsmZCTq/6z2nFQ1qawvO8e NNYThKL5dDNmWi0mqaEYTr9mscD/zop7Y70BlMU0XZ34sZTxFg9wFubs3dINIXL2QyXw ZXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733097034; x=1733701834; h=cc: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=AeL35E25CSdzRt6ed826Hwg537xq4Ku8UoukklIpWKk=; b=klBt10F2fN7FwXNjf4pglfQbBgKe4radCltcJRba/WYXtRWBHbCZ5RYWg5T/N492ZQ qH72ygDAxGMoHlJh/3CqX7LYYeTImshoSU+K6ZPwz8UWn2ifCyopHREtt9atZQTtmLFQ lgesKZf9YZYtuQewRzxnDhbk48iKzYuireJ4fGk4bHxkGi7a7ChHqhDLrop+p7YtRw2f nB4Ayx3E2lWzNBjTvru/6EaMuufRizuzvdJqIJU1FDpr5rrNERhEPVk3854BgdvLROdH G+esqD4WbaOoW/IAepO2sjwbr9dUmAc6KuVXTi9mxIhXl8XDeG/tKIBVGf7fzO3+iKlX D3DA== X-Gm-Message-State: AOJu0YwMycxeMVrrsproVlt/DHPkUUI1XV89r0HhuwWG0j7nBYN09qED 6VdslXUsDTmrm1rNrKXEu3kCrOc2wEQ3Xya76BM7CVa0aA7qR65Mb5Q4X7I/kNfSTiQ9YXDfsWP ngGbfC6qqLkDxsQyPW+DBmgJshhDTSg== X-Gm-Gg: ASbGncv2HuqxsYIwVXtNhkxSnQMLHTKquJOd1AXEZ9Ue+BxDbnPHsm5gcGCznN1HcNh /iTmAgyn0LGj3kYm84ziIHg8Jv2m6ENHx X-Google-Smtp-Source: AGHT+IGKLFvtcNLQb3NWzfiqsQFi14KkquXs53SQzwznS/0KF/Yr3f/5fgCUONqhKwC2U5NSWf54G84mLeDsjI1izEs= X-Received: by 2002:a17:907:7856:b0:aa5:27a8:4cbc with SMTP id a640c23a62f3a-aa580f266c6mr1803366666b.15.1733097033674; Sun, 01 Dec 2024 15:50:33 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 2 Dec 2024 09:50:22 +1000 Message-ID: Subject: Re: [PHP-DEV] Re: Inaccurate documentation on return values from native functions Cc: internals Content-Type: multipart/alternative; boundary="0000000000000db93f06283e196a" From: mickmackusa@gmail.com (mickmackusa) --0000000000000db93f06283e196a Content-Type: text/plain; charset="UTF-8" > > I am not sure that this is purely a problem with the documentation. > > It seems possible to me that someone updated the documentation to > reflect a > > new intention for these functions. > > Will it not be that these functions will be altered in the core to do > what > > the documentation says? > > If the docs are not correct, we cannot simply change the source to > conform for BC reasons. > > In this case, see . > I can appreciate that. Going forward, is there any benefit to preserving the behavior of returning integers beyond -1, 0, and 1? Should these topically related functions receive a new last argument? bool $distance = false I don't know if there is already an established naming convention for such a value in a function signature. This way codebases that rely on the historic behavior can set $distance as true, otherwise omit the parameter. Or is there absolutely no reason to return the calculated distance because a 3-way return is all that is ever needed? mickmackusa --0000000000000db93f06283e196a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

> I am not sure that this = is purely a problem with the documentation.
> It seems possible to me that someone updated the documentation to refl= ect a
> new intention for these functions.
> Will it not be that these functions will be altered in the core to do = what
> the documentation says?

If the docs are not correct, we cannot simply change the source to
conform for BC reasons.

In this case, see <https://github.com/php/doc-en/issues/= 3629>.

I can appreciate that.=C2= =A0 Going forward, is there any benefit to preserving the behavior of retur= ning integers beyond -1, 0, and 1?
Should these topically related functi= ons receive a new last argument? bool $distance =3D false
I don't know if there is alr= eady an established naming convention for such a value in a function signat= ure.
This way codebases that rely on the historic behavior can se= t $distance as true, otherwise omit the parameter.
Or is there ab= solutely no reason to return the calculated distance because a 3-way return= is all that is ever needed?

mickmackusa
--0000000000000db93f06283e196a--