Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129615 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 930E51A00BC for ; Tue, 16 Dec 2025 07:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765871616; bh=DyHyDBkEK8b86SDpaNb0IasmAaer8laYbnuHiT0Dbf8=; h=References:In-Reply-To:From:Date:Subject:To:From; b=Xyjf9qWIG9rx6V3v9TGRLXE5XzTkXrvWsS26LWAwjT2ieG5kqkIxq1C3/OC10vqLR 3yrgrCZiM9DAESivLLgCh+OA7kCb21SOc1borffkySu5vRQMSa1JgWEHUR3Rf1yftt MjzFnq4tLui8lkouihzTEvG1DPpdO44D+WTDNwdnWhlWAdKy63XMqceTFJPvsPDcVs ddCT0efLEhn+UUo7A077tk8PzhgXm4BL3f0gOhpWtTH3aO8CeCLIZAdxfRLKXq0kn5 NLXraUTk39NiEW9Noti1rd3WLet4kZK1C2eLb955WAp4jFz9BAuvB3XpJO7tnYUy1x cs8EFMibyhwAw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 60B30180041 for ; Tue, 16 Dec 2025 07:53:35 +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,FREEMAIL_FROM, HTML_MESSAGE,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: No X-Envelope-From: Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) (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 Dec 2025 07:53:35 +0000 (UTC) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-3e898ba2a03so3098144fac.0 for ; Mon, 15 Dec 2025 23:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765871609; x=1766476409; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=dqX52fqOiG3EVrTcsb1vUMxh1/gRSytXrjBTIeVkP24=; b=AMQ3Rlbr1O020EWa3Cc7JWJsi3qBsj5cComvgy79ZT/fGahB9V3he7MBejtAYHvdc6 EriVah84G+//QsYU6hhvzsaGVF6wsYq5TKVvQ5RbuiCp5SbhvVtiUCvM6k74jq57oLJL VG3Qe9DKF/cXPD7QU4g9mXiNAu4mVncd+PwErHioYi/zvW//jTLEEUoQObfHPM0JMDVV urRVuldZadWk2/wyGnbR5+0qFToyvtIGiy7OaMoom2zGrObBfRJ/JJtNAxW5z08Bo1Qe cUsD8usSCG8O2hxJ02IovAfgtad00d+Hdu59KmU2CGpS/uYuy9xW+G9ka1cZlgM/5wGZ hu0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765871609; x=1766476409; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dqX52fqOiG3EVrTcsb1vUMxh1/gRSytXrjBTIeVkP24=; b=vy6aQLgJ5Up35VndhjhmoVRQBCqAiq/PMIAhwxTjtxej9o56X8mZ81/S+w3sRsho/k jFCg3+H0a4yC2K/53Pq7f4rH3rQx+3AgUZ/9kka3Rns9DyZHyeVDNZLcMgKco7jFU8JE hHw+YZgR5j7f16smEvfbLaY829r45ZMXB2TXx3FUKBU+GslVzYs/Nfng3hoU2vcYnkOC Q5IhigqyD9EWm1AwGq5rk4eOWdy5YiMQVnuLLzTgwaO8Zk7I3+0fkfHz17x2yjNjqC7r nWz0wt3nGx2sJ85gitK6aBmHVESGvb6sN6L+RMej1CG4pa++h7VJN19LteQv7N1lM+cC +m+A== X-Forwarded-Encrypted: i=1; AJvYcCWdkTQtAvdBkWJ9bOKaHsd3F3uQQLdmofCzxxa+uUDjfafdOJ/VQYb4gi/dl8m/cponANFp5dNIJhs=@lists.php.net X-Gm-Message-State: AOJu0YxsoQ7yRDCneW0n74pLAOcXThzd7RMuIz2ZRMhQo943IFT27pMm cbMgFGl1lcoPOSI2x9oJH1Tdw3nOXOxEU7cGCfZFX7I+iTQmFPzqwM8ihzsaAoG8qIZX3htrXLB 8QzAxdVR90+Jmc58E3g4MtFmHla0Q2eY= X-Gm-Gg: AY/fxX7GncWRrMvxaSIAin9Tur11S8vKE6K4hG9M49DfLshdGW+iaJvUz8+OQsMOW/M HLxmIQxcMgn8BtCH4+Pj+3riNAYyVcsbgyY37dSi4sdDPPWV2H+Kqb9ZEMmsgQdsSyZNMkJ73vl JFbrRQBzCo/Zp95sZwcvMiUYX7mYe9p444CQLDepcc7MBJt4yGjF3OXI9EZ4AoZOceJxPy6VDnI JyQihW7g2jihTP9mqz5j6vhcnk1gc23CdKj2jyVFavb9HQoQoGwihF4l6JMePikhAgRMAf1W9m2 DUtPsjk= X-Google-Smtp-Source: AGHT+IHuSiOaCmv7WYa6guG3ndlddXZELJi01LDB7eGhKr+NyxoJ/GyC1ZkaCD+5W9t13JaJKgVKUSavgrK13pCdx+E= X-Received: by 2002:a05:6820:4c84:b0:659:9a49:906a with SMTP id 006d021491bc7-65b4523b559mr6243328eaf.53.1765871609476; Mon, 15 Dec 2025 23:53:29 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <83238ad3-c844-4457-dfb3-11321787e022@php.net> In-Reply-To: Date: Tue, 16 Dec 2025 08:53:18 +0100 X-Gm-Features: AQt7F2phb9KxSnfaDlwhRpsRe3WJL5_3Xash6LeumJtw58lrW4bgdPjMcLhEIAk Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Followup Improvements for ext/uri To: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= , =?UTF-8?Q?Tim_D=C3=BCsterhus?= , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000007b1f06460d062e" From: nyamsprod@gmail.com (ignace nyamagana butera) --000000000000007b1f06460d062e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi M=C3=A1t=C3=A9, After thinking about it and trying some different logics I believe the following rules should be applied during conversion from array to query string. - *object*: invalid mapping, throws a TypeError - *resource*: invalid mapping, throws a TypeError - *array*: if a resource or an object is present in the array it should throw a ValueError - *null*: should be allowed (['a' =3D> null] should return "&a" (no `= =3D` sign added). Currently entries with null values are skipped. Currently in PHP, when using parse_str , &a is converted to ['a' =3D> ''] = I presume this behaviour was done so that the variable `$a` could still be accessible in a PHP script with an empty string as value instead of being the value null. Since we will be dealing with arrays the following rules could be updated when parsing the string using PHP behaviour: - no mangled data should occur on parsing - "&a" should be converted to ['a' =3D> null] - the removal of the presence of indices if the array is a list. (would be a nice to have, to reduce the query string length, but not mandatory) Best regards, Ignace --000000000000007b1f06460d062e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0M=C3=A1t=C3=A9,

After thinking = about it and trying some different logics I believe=C2=A0 the following rul= es should be applied during conversion from array to query string.

<= /div>
  • object:=C2=A0inv= alid mapping, throws a=C2=A0TypeError=C2=A0
  • resource:=C2=A0invalid mapping, throws a=C2=A0TypeError=C2=A0
  • array= :=C2=A0if a resource or an object is present in the array it should throw a= =C2=A0ValueError
  • null:=C2=A0 should be allowed (['a' =3D> null] should return "= &a" (no `=3D` sign added). Currently entries with null values are = skipped.
Currently in PHP,=C2=A0<= font color=3D"#333333" face=3D"Fira Sans, Source Sans Pro, Helvetica, Arial= , sans-serif">when using=C2=A0parse_str=C2=A0,<= /font>=C2=A0=C2=A0&a is converted to ['a' =3D> '']=C2=A0 =C2=A0I presume this behaviour=C2=A0was done so that the variable `$= a` could still be accessible in a PHP script with an empty=C2=A0string as valu= e instead of being the value null.=C2=A0Since we will be dealing wit= h arrays the following rules could be updated when parsing the string using= PHP behaviour:

  • = no mangled data should occur on parsing
  • "&a"= ;=C2=A0should be converted to=C2=A0['a' =3D> null]
  • the removal=C2=A0of the presence o= f indices if the array is a list. (would be a nice to have, to reduce the q= uery string length, but not mandatory)
Best regards,
Ignace
--000000000000007b1f06460d062e--