Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129485 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 4F67B1A00BC for ; Mon, 1 Dec 2025 20:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764619970; bh=xe22D64SDNirjnvC40nvP2OWel3jBwBR6YSEBgLGjXc=; h=Date:From:To:Subject:From; b=a2TfLXugfgSCmsctUccTk6ZNBVdQJshrIAIuFpXX9N4tefzlxqIwPtImmee1HHO0j zzwTObpy7P96x6F8ckI0NiTzVzBNorNx/fDpiU40hpZEXL7RKRRAlGGl87NXOny/MA 2GyrHB/8TUc56WRGtEBT9JmGqhdyzgLuDnPaz3HhpY3XtWbOi7IeaPMpFG6X4vDs7X Ul3FiQ41dXBWM+KH/OSffpQGdHZ2vcR/OswvVAy4vDbceaq9ikjJQo3M9CeWu2ZFHk fO0YcpWKR4TIM5r6Q+7REKXj6JH5Jv/5IlIqRCeMfzCmyJGxM9SMkgZ2hTHOyx6U78 cizIah0/yWc8w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5E8581801DF for ; Mon, 1 Dec 2025 20:12:49 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail.kd2.org (carotte.kd2.org [188.165.240.126]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 1 Dec 2025 20:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bohwaz.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=xe22D64SDNirjnvC40nvP2OWel3jBwBR6YSEBgLGjXc=; b=XkFb9BdL7I1MQwXehM3RxqNgXV OR3A1NYMZng5lWY3t4miSwjSg6q0N3d08awP1lkvZOILd4CcI5xR+SatoBPi/b8WflvDfNc9Z9tDP sGgXaRJhDFiRke2qd67HiYWwz/OC+eIklBWXB9ynCfP9+B7uvBR/ufpNHkld6TsB8I5I=; Received-SPF: softfail (mail.kd2.org: transitioning domain of bohwaz.net does not designate 2a02:8429:27d2:9a01:f404:feb2:ac34:2560 as permitted sender) client-ip=2a02:8429:27d2:9a01:f404:feb2:ac34:2560; envelope-from=php@bohwaz.net; helo=platypus; Received: from 2a02-8429-27d2-9a01-f404-feb2-ac34-2560.rev.sfr.net ([2a02:8429:27d2:9a01:f404:feb2:ac34:2560] helo=platypus) by mail.kd2.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vQAGJ-0000000FCXD-1RnK for internals@lists.php.net; Mon, 01 Dec 2025 21:12:43 +0100 Date: Mon, 1 Dec 2025 21:12:36 +0100 To: PHP internals Subject: [PHP-DEV] Change output of gettype? Message-ID: <20251201211236.566237a1@platypus> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-pc-linux-gnu) X-Face: #"dGtXaYpS9,C:d{FJZ<@4|;AL[R;I`|\;HN}zkw(rmBsu$)Dhed/z8e%U@Ra@JQ;,Nx?Xopxa+:gb?}efqG\/7TnBPHBRjU^g}$;rL4"jYrE#M^%*(?;Qb{HHbOf"q}bnOjU.'SEL:||\2*swZ>NN9pe(pnejy{ijk9%/8 list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Invalid-HELO: HELO is no FQDN (contains no dot) (See RFC2821 4.1.1.1) X-Sender-Verify: FAILED () X-Sender-Verify: SUCCEEDED (sender exists & accepts mail) From: php@bohwaz.net (BohwaZ) Hi all, PHP 8.5 has deprecated the following type names: - integer - double - boolean - binary But the gettype() function still returns integer, double and boolean instead of int, float and bool. This inconsistency is quite confusing for new developers (and even older ones). I understand that changing the return of gettype might break a lot of existing code, so maybe it's not a good idea (yet). But maybe we could add a parameter to gettype, for example: gettype(mixed $value, bool $strict = false): string If true, then it would return the "new" canonical names. And then in the next version emit a depreciation notice if $strict is not supplied. And then in PHP 9 maybe change the default return of gettype, but still allow to pass $strict = false, so that upgrading the existing code base would just be a matter of doing a regexp replace of gettype(...) to gettype(..., false). Adding a depreciation notice if $strict is not supplied would make things just painful for everyone I think though. It's a small thing but it seems like having the same canonical names everywhere would make things more consistent. Or the cheap solution would be to just add the $strict parameter and update the gettype documentation to say that the types returned by default are not the "new" scalar and passing $strict is needed in order to match what "new" PHP is using. Cheers everyone.