Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126768 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 E28BC1A00BC for ; Fri, 14 Mar 2025 21:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741988348; bh=le2t8dKvOFR+FuYz+tDbtMHi9zWXzmV03vHDZCWqa3o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=l8758X8KVIrNP/P6OM3OvQ+DXT1silFW/lqgSq7kj5F6HT6FoA/hj7Ehkz8e+a3Rh uo365uZwczFRX8NajHfvu2GqAmFkdMJft91NU9L8RAz8uBwK0ulc0Iv+4Aby2gw+lr 7oIVVZr55m8Vf4/shhjmheGLv5bGwTYzz/LYfuVQ8DHP2kfMRS8Naw/Zxm0ilKQAOH Ex9SG6FLKPOCFmfT2+OUZ9ZMFmSBDdF2l/srq/3NyzV/E/o+QxouJqMI1CyUXF7a1Q q7t9oGdr6DYjYt1qhyzE6JiJ6qQbrVLZ7mgqV+lHZxjnrgVszU5+41e0xWsysXBglL k8oEVsrjWwcdg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4025D180037 for ; Fri, 14 Mar 2025 21:39:08 +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=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, 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-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (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 ; Fri, 14 Mar 2025 21:39:08 +0000 (UTC) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-476ac73c76fso27218121cf.0 for ; Fri, 14 Mar 2025 14:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741988500; x=1742593300; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=le2t8dKvOFR+FuYz+tDbtMHi9zWXzmV03vHDZCWqa3o=; b=UYz6x+bVfGj4ZXpqroejbl+ZaYpq2lXzhS9g6hMe2PLkV08Qg3ECXQD+JDdp5r4ol0 gvWiJx9B+D9HVUzWzcgNh2rMggP0nQvnP9q5OOqBXGyzOtzxUD1BaOfSEiirEuyLWDDF 6Uk2S8UF3/rzz/JLp84nrs+qPhCyUcYrVqaz0MdsDz2b/wGcOrv/WERQ5mNbOIcRMYgH O1+IU7/gQN2d0YHLNyijgpceAdefbAKlMH8m2yPMgK0VNvVy79GlBTPYBA1LCzYC9jKn hZrwVj2s/OWdFhDKRzdEIGcaKaatB2tLBaJ4TXDG3RN6M0CKr0wKKjeBcXrEzgbdlEOZ s1wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741988500; x=1742593300; h=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=le2t8dKvOFR+FuYz+tDbtMHi9zWXzmV03vHDZCWqa3o=; b=cPvTuEDkqEqwm7aZPNCeyJaYZ+YuVQbwxkrK70ridGjvMvamTy9Fo2ziKZDRJEz83E QDsanEW/jFsBzPVaRnWmR75HPlQU0HuKTBN0k0ZWI2RmUDg+9Y8rJBZUPaG0hXsCTlpH YhyNbFun2azWe7Kimi8gzP6CSlNtcXH0kKQxNbA3b5tre6Tn/UYw2WYesSmh5F29lMr0 dP+XMhVxGNqP5pb02Qaz3DjWCjA2ZU5HDRRJx3cquUt+mtd0lnQnku3319txMfSeVeuC iQwLoOQh9Zt5j2Zy6jDT3CSr37VtHrpaJ15x6DQL9ZN6JC4S6NfsLOdpDHjk5MJNfO7h acQw== X-Forwarded-Encrypted: i=1; AJvYcCWVLrx28yIvbxwRK9NuFZwJR7rPNbbo0ui1X/nfg+Zr1HHUMlEA0lkR3fTVLGKS3WfHnSozX+B46i8=@lists.php.net X-Gm-Message-State: AOJu0YyHLWAy1JcipvuurvnfpujVrj4t3mJ4lBtNAgXQFNLF8uL7kbL8 rix+w5qMatEC4nUdDKPAr18uv/oMZcAH6YdkqdfWi7SXFG+oPCLh1erEgEmDHRte3Mjth7Tdlps 0rBhtA4ED8nSFrW6cv/4wDek1f7WvUCZOp8v2WA== X-Gm-Gg: ASbGncsAoKfwDh9WlgZ+xGLNhKGA3A3ZpyAfbAz54PPZN9ywvQ00yIsUqSp6jiLUgTq JcJ/SXg/sFoqkw0zX6jPSX9JJtGjE1U3glB139j+9XpHkvmesYVcRcrKuDBwxMbxxNqjvfvtzoM 4aGgGQDXE92rqC1GGYdKMVwHsI8g== X-Google-Smtp-Source: AGHT+IHnLMARZhL9+nsGwWbZwE6l6WKb0lGg1Sgu5FcmK1+A0BfAUYDU/89QVZKKYtOe/ZE2XblxRqe0w4rwyRhF2nU= X-Received: by 2002:ac8:7f04:0:b0:476:8db0:8caf with SMTP id d75a77b69052e-476c8130fa7mr75698681cf.1.1741988500179; Fri, 14 Mar 2025 14:41:40 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <811B65CE-1DF0-4A47-937C-4FCB6E945B92@pmjones.io> <19377F60-FB7F-4E6E-A085-4DCB6CD92234@pmjones.io> <7B7987C6-37F3-432A-8BA2-9D93F428FAD5@pmjones.io> <93898e96-bbd6-4c2e-a1ad-35499bb2510d@app.fastmail.com> In-Reply-To: Date: Fri, 14 Mar 2025 22:41:28 +0100 X-Gm-Features: AQ5f1Jq2gA4_9jsu3DUh6sNaDurTVKHf962MhWA7-PPBwlEVc6pt_EXebSNe2kA Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API To: Lynn Cc: Rob Landers , Faizan Akram Dar , "Paul M. Jones" , ignace nyamagana butera , =?UTF-8?Q?Tim_D=C3=BCsterhus?= , "Gina P. Banyard" , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000c190b50630544d5b" From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --000000000000c190b50630544d5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Depends on there being the intention to have it as parameter type. If it's > designed to be passed around to functions I really don't want it to be an > array. I am maintaining a legacy codebase where arrays are being used as > hashmaps pretty much everywhere, and it's error prone. We lose all kinds = of > features like "find usages" and refactoring key/property names. Silly typ= os > in array keys with no actual validation of any kind cause null values and > annoying to find bugs. > > I agree that hashmaps can be really easy to use, but not as data > structures outside of the function/method scope they were defined in. If > value vs object semantics are important here, then something that is > forward compatible with whatever structs may hold in the future could be > interesting. > Yes, I agree here, even if we talk about simple data without behavior. But as the length of the current RFC also suggests, URIs have surprisingly lot of behavior, so I think it's natural to use OO for modelling them. M=C3=A1t=C3=A9 --000000000000c190b50630544d5b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

Depends on there being the intenti= on to have it as parameter type. If it's designed to be passed around t= o functions I really don't want it to be an array. I am maintaining a l= egacy codebase where arrays are being used as hashmaps pretty much everywhe= re, and it's error=C2=A0prone. We lose all kinds of features like "= ;find usages" and refactoring key/property names. Silly typos in array= keys with no actual validation of any kind cause=C2=A0null values and anno= ying to find bugs.

I agree that hashmaps=C2=A0can = be really easy to use, but not as data structures outside of the function/m= ethod scope they were defined in. If value vs object semantics are importan= t here, then something that is forward compatible with whatever structs may= hold in the future could be interesting.

Yes, I agree here, even if we talk about simple data witho= ut behavior. But as the length of the current RFC also suggests, URIs have = surprisingly lot of behavior,=C2=A0so I think it's natural to use OO fo= r modelling them.

M=C3=A1t=C3=A9
--000000000000c190b50630544d5b--