Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128259 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 6742E1A00BC for ; Mon, 28 Jul 2025 13:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753707755; bh=2YEapkDKPjiA4HHd5alM1lgWFP9oAYnkvyEevzHM+Vs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oDTFH/kFVGcRMX0WoMf1bRckT7pktVCu6TITCVvJRDrD89i4l0MKv3IXtPOuDQUrO Hw2CsbxIvPoGDUORQxziHeS96Wjrt8RDQnELEyIYDWUJHEwlGexE31040qf35z/kR1 5DJpf2PKxPE/xDkxy9+N4xnlamm3Fj9NqqJwT8/j15BArJJ1wJKb1zhV5znAdPcQUq yNexdPMi/MI+XljBIRsAKTb38GzUF8X2RhJU+7yE5bl8sgDqb4kTtbh3SfaWZz+yXk 2wNvbeE10GwHeVc51m4+9zFckT7uP1+f5QQs5cgiG4D1pOBfEXYmnVTvz0R+80KNRP a7LX+lKKManhA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E130D180393 for ; Mon, 28 Jul 2025 13:02:32 +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=-1.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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, 28 Jul 2025 13:02:30 +0000 (UTC) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-60c5b8ee2d9so9090887a12.2 for ; Mon, 28 Jul 2025 06:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753707853; x=1754312653; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2YEapkDKPjiA4HHd5alM1lgWFP9oAYnkvyEevzHM+Vs=; b=UxlynHeDZx6/b8jBiBxRHvZAF8Lx8ddUy96r5qHnAWqyfq/fjB4zMrxU8ALbDUdx6A sBHt8O0+yMkTVC++W8cDMBy89N1w+u3Re4CucQXvjd8WtJ+BeWj9aVBN0uxWbpSDwUHT u5aFGje5YOs9MSbakEBx1LywohiZPcESYEFlH1c3bGc45nP5L1w7rHBUQlFmYAZuCZuv gqcRV5Mfw+Kyg/5skjWSvC478mgrswwTB8cZ5NezowSWrdLABr5Oi77MhPz1mPeOhDmF 0T98VPypdRYAHUaWF6fUhSczb3yvOOLqdRL+TUweyHQe5CKlYm0C9xpxUlG/jR0K4Zyf 08cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753707853; x=1754312653; h=content-transfer-encoding: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=2YEapkDKPjiA4HHd5alM1lgWFP9oAYnkvyEevzHM+Vs=; b=qMmvy+k1n1D+M5x5OYXgprUYwVLo8eMAYcYstBMptLITb1e10OcLvKwPuFa/QufF/J YFLmv1Q54I0IfVc3qwKM5sZqfzE5QvcwnwlH2hXUe87a1vdvc26u6+adp1XYB2XOx08S E3VbJXjmhZrDCQLcACeWbVpyRxoKuCNvtz1YlJY6sAswh77S1l1u+MZPFC8Ez1gxQqoj KcjMw3OG16A1eI8fq2nrdxNTyL+VFHGTHVM9H5APW6+eioGJWCiytONERi71IPcEkfKD EFEV8AdgMt2VSWmTphl/2snsZXlQ31lf3MLFSzKkscm+8XvfFJ+i23MbKybGlaFgMmOf GTVQ== X-Forwarded-Encrypted: i=1; AJvYcCWpu13g40kWJSNVWqZLE/S+tFMeaWKOSn4zTx4Sb5HCbgmWtm8dGf/JC1cHLwJ0fvXcC/ind9n0l9A=@lists.php.net X-Gm-Message-State: AOJu0YyFEtiAP+Lnwl15cEqGbeqbD3titlL47raYz5Wt90SCDRoA4FpL 2ycg6GZudem45ZvB/RvLUxbnwQdpiosqkWIu1xjNi+cmRDU9W5Qj0qNLum3+K1MvQc/fBboQDHL zZY1TTnP2m2fTYg6HK1sGYZ9U9vcNOtEJvQ== X-Gm-Gg: ASbGncuBu/EG/VBqeEoQ9C0cvVZcyIK7BTj8GjQGe56gNtRkA7TVYqaaLHuwrlIgo52 1XeloGC2qbXNdz1ldpJL0/ZLMwqyUTQAL02nIe4iZQ40wMQFkmpRQA/XV14JXdvszvSMRMFZrQ9 b3ks7kki2IW5hziw8uNKywe0F0jkFWgw6WzztrDOK3NdQe3Cv/LalEEiw3PLFZpOVM+zrldBuAo lG2FE3Ldn1YDmQlXh1k16sB0Mw89/5ml/TE+IXPsxT94flSIpfy X-Google-Smtp-Source: AGHT+IHTrivhQqkUJBIRBM1sHYiNdCIk0TSBwBrLmj6OSAi9dm6yjnMiB5oGeFovj+pUhPS6kj0gUyzuwdi2YzGtfqo= X-Received: by 2002:a05:6402:34c3:b0:615:234e:9b70 with SMTP id 4fb4d7f45d1cf-615234e9d20mr5405169a12.34.1753707852487; Mon, 28 Jul 2025 06:04:12 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <20FC2F27-1EB0-4C33-A3DC-EDF7FF5961F3@gmail.com> In-Reply-To: <20FC2F27-1EB0-4C33-A3DC-EDF7FF5961F3@gmail.com> Date: Mon, 28 Jul 2025 15:04:01 +0200 X-Gm-Features: Ac12FXzx3zo1xQ0iB3Ycnnv207EMQCDx1Y5JU7ZKw7SjeixIuanIsrkOqLkEMnM Message-ID: Subject: Re: [PHP-DEV] [DISCUSSION] Adding the "is_integer_safe()" function To: Claude Pache Cc: "Rowan Tommins [IMSoP]" , internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: alex.daubois+php@gmail.com (Alexandre Daubois) Le lun. 28 juil. 2025 =C3=A0 12:18, Claude Pache a= =C3=A9crit : > This is not correct: 2**53 + 1 is perfectly =E2=80=9Csafe=E2=80=9D (for 6= 4-bit builds of PHP), see: https://3v4l.org/P939d > > The specific notion of =E2=80=9Csafe integer=E2=80=9D as introduced in Ja= vaScript makes sense only for numbers encoded using IEEE 754, which is what= PHP uses for `float`. In PHP, there is a specialised type for integers, so= that the need of such a function is not clear, because every integer encod= ed as `int` is =E2=80=9Csafe=E2=80=9D. Or maybe you want something like `is= _safe_integer_when_interpreted_as_float()`? > > Also, note that the particular Symfony example given at the beginning of = this thread uses a function that expects a string, not an int or a float. I= n that example, something like `is_numeric_value_producing_exact_integer_wh= en_interpreted_as_float()` could have been useful, but this use case is ver= y specialised. > > =E2=80=94Claude Right! I think we found Gina proposed a nice alternative. I wrote a few specs in my last thread message in response to Gina. Please let me know if there's something that is unclear or bothering you. Best, Alexandre Daubois