Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128708 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 373B71A00BC for ; Tue, 16 Sep 2025 15:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1758037083; bh=XJ+Po+UuvG8ea7C10MUC0m64lhTVRg3kPtmZm3uGcVs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=np+PmKJHMlWAfQVKZRZ7NPFJpnldbXg4YXLSdKrdenGKyy4gGs0RDPJ+VTUyPYJa0 LafLaeUAThAVW0HpgdcxDaR+mmumRmq/I//zaJDTtXXtuBdU25QzWq7kPyIMaaHI6U ul1QYfTCnaVLAc1bgSrj0WZX8v/4mdxzbrfr1bhQbUd1ovBt613WQQdT/91LgoxIo0 3O+s8LvuMH1uanp/FbeWHMCzWopwezuk3V9qiIGs36gUeqQxZNXhdZyYo4TQzoiuWl 8ZjSs7NC7loA2z73zuX524sHoLdcckeTEhbuD2Qw/iY0vYLl6n1SE412fik6HSfVmC 4lsM3+nNBizHw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7AB4C18004E for ; Tue, 16 Sep 2025 15:38:02 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Tue, 16 Sep 2025 15:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1758037165; bh=rS0sGIAM+hcsCoT0BRBh17xO0llxQDANdY0/WgI5TBc=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=Zgq7yu4CFy+TvT22wLozVCL6vaGlPoRhUefWg5t7JdY/JlCCqhK5DTLCWBEl5XKl0 5wv3OddSLl7snK+uAW0Stc4wb5P7zK+I/+ECSTjnPHm+/1ue10pBKjiBLyD44kRN+x Y1pV7uClei+jCYjBSdrx14UKZUhlsbAY1oPwYqhF1Q23ev0GxH0eIeXROLBvY12tGJ vlP5ZatALPiiDjBRI9PK14uuxJ3YWQTN2zIsFwU6pmj2Y4BrXt2XSIeCY/31egsDSZ sHwdYVjASx5kd84tn5qebaHFn+ThgzxnPgAi0JcGHf0HyA4O7ee9v4OllUKRa8iWIF SXo5icvsGeLYg== Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 16 Sep 2025 17:39:24 +0200 To: Alexandre Daubois Cc: PHP internals list Subject: Re: [PHP-DEV] [RFC] Add pack()/unpack() support for signed integers with specific endianness In-Reply-To: References: Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-09-16 16:50, schrieb Alexandre Daubois: > Indeed, it is just that I'm not sure that it is worth adding modifiers > support to pack and unpack as with this addition, most (if not all) > cases should be covered then. I don't think it is worth blocking more letters that are also incompatible with the language where pack() was “borrowed” from. >> This is simply false. v/n/V/N identically exist in Perl. J is not >> clear >> to me, and P appears to be different (but I don't do enough Perl to >> say >> for certain). > > Perl and PHP share common letters, you are right. But looking at the They don't just “share common letters”. The pack() function is directly coming from Perl and that is also documented: > The idea for this function was taken from Perl and all formatting codes > work the same as in Perl. However, there are some formatting codes that > are missing such as Perl's "u" format code. . > table of each language, there are many differences. However, I may > reword it as I realized that the RFC states that differences appear > with specific endianness letters (and you showed that it's not true). > There are many differences when we're not talking about endian > specific formats actually. I'm not sure if “all formatting codes work the same” is still 100% accurate (due to J and P), but “many differences” is definitely false. I'm seeing the following differences: - J and P might or might not be different. - e, E, g, and G don't exist in Perl (it would be d<, d>, f<, and f> respectively; these format specifiers could be deprecated if this RFC ships). Both w and W are already taken in Perl and would actually be a difference. Best regards Tim Düsterhus