Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121029 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46921 invoked from network); 10 Sep 2023 13:35:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Sep 2023 13:35:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C8941804AA for ; Sun, 10 Sep 2023 06:35:29 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 10 Sep 2023 06:35:29 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-402d0eda361so41669655e9.0 for ; Sun, 10 Sep 2023 06:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694352928; x=1694957728; darn=lists.php.net; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=79GFbq8qKiSUZGvE48sOw0z4ugUNUILk2V0mO5X2Cyo=; b=SvfAo7TqqQArPwgrYjQbtO6P7bGIQpSeavr2D4h5YxA3duHShJFBy+2zKxwP5D+doW qIgxhUNo1IEe2ASlLDWV53AZIkUI599uELm0or/mfadc31Ta7esghpOnKyTubfJ4wgHA UluXURZWvc7M0BL3Vcp1pQZXed1n2c1K7+BUw2NWJApj8EPwEwroPpdwWBi0ol+3BrB+ df9GBAT9f0Bn1xOHgM6kELYC3vN3RmO5XAQA6+MvUwnGN/YKsbzazdWWtAArroE10C9N QVtGbd+y6yJQXpNLoCo85pJms+go5jzvL2pPOIws7EzX+PdOs3lMqbxywMdB1khXOinV 3kcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694352928; x=1694957728; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=79GFbq8qKiSUZGvE48sOw0z4ugUNUILk2V0mO5X2Cyo=; b=ae1O3nJ9k7B6/gXCmk5YB07JD6RwdxtuIE2cz5moIV8N/mvmxBF7G69cFImAMKTMlo Sj6AVjVp3mx12MDDtPPqzGhLe8D/Lx47NFkwfZj9yuvfFm1ZDCtB3TjA7yadbA704DNY pRV/oBbkO5lXohxGw/AGN3RuRDopAKu14zO11cIWSZB/sTOe7RzgX9g29HeWzIcNNDIh 0tU6nStCfsvpPPRXBkTH/Dr7JaivB9dFQvowy+aLFpzhKlMCVNmo4cNxWl8ZMTHlxO5i YJXan6eLG+SGij7sWc3K4J2zN5Vl9Lk7iEgv/FWOPmy6iOIW2YTlPMcVHGU6iDpGWWyj QtRw== X-Gm-Message-State: AOJu0YyL3Jrzd2xohZ2jxEt7E1DTcGVDH2pOfqIbz2Kxyalu6V9oIB/P vFc2CgQ7FyF6x7SnE5Jxo0IyS0D1Tr8= X-Google-Smtp-Source: AGHT+IF2lmYWygeTTOYY7sLLAJfEeHH2aPUqfswH7lJm+/7JpRdLhHsnV7e7/lwIiclt5oPYvGvuYw== X-Received: by 2002:a7b:c8d1:0:b0:401:b1c6:97d8 with SMTP id f17-20020a7bc8d1000000b00401b1c697d8mr6424700wml.35.1694352927519; Sun, 10 Sep 2023 06:35:27 -0700 (PDT) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id n22-20020a7bcbd6000000b003fef3180e7asm10446641wmi.44.2023.09.10.06.35.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Sep 2023 06:35:26 -0700 (PDT) Date: Sun, 10 Sep 2023 14:35:24 +0100 To: internals@lists.php.net User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <525DC2B4-989F-4E26-AC13-F936FF25DF2F@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Proposal: $options argument for SimpleXMLElement::asXML From: rowan.collins@gmail.com (Rowan Tommins) On 9 September 2023 21:05:37 BST, Niels Dossche wrote: >Hi internals > >I came across https://bugs=2Ephp=2Enet/bug=2Ephp?id=3D67387=2E >Passing the option in via the constructor doesn't work because the constr= uctor only allows parser options=2E >We can implement support for options (such as LIBXML_NOXMLDECL, LIBXML_SA= VE_NOEMPTYTAG) by adding an (optional) argument to the asXML function: `?in= t $options =3D 0`=2E In principle, I agree that that makes a lot of sense=2E >This would be a BC break, because userland classes extending from SimpleX= MLElement *and* overriding asXML would have to change the signature of asXM= L=2E Ah, that's a pain=2E I can think of two solutions that avoid the BC break,= but neither are great: 1) Create a new method, e=2Eg=2E asXmlWithOptions()=2E No BC break unless = someone happens to have a method of that name on their sub-class, but an aw= kward name in the long-term=2E 2) Allow output options on the constructor, and carry them forwards throug= h instances until asXml() is called=2E No BC break, but not very intuitive= =2E Actually, it occurs to me that if you think of the options as stateful on = the instance, a third option is to have a setOutputOptions() method to be c= alled before asXml()=2E Still a bit clunky though=2E Regards, --=20 Rowan Tommins [IMSoP]