Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123224 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 5041D1A009C for ; Sun, 28 Apr 2024 12:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1714308614; bh=GJUwoNis3toordK/XhyZ4FaWCYAQgIpOPwHAyV5PD8M=; h=Date:To:From:Subject:From; b=FAOl+jyKtVlCGHj+RJM+y89SiNAWNK04aWmlSN1BeULOjTmCC/b+cjB9bZQN/UAW5 Nffp1yRH7MT7+i7ddk/UAfS1+vRsWIVFeE/ahIv9FFhSTLAV0rUncRmitm6BDEeEXF 2PIFN3Dfsh/zBzn0hMgi7ME0geA14gsyXYe2U1+oUE0LqttH/sNSW8zXlit8vZ209n 3AouIMJ9cRx85uFaivXoJiOKuNiLWj/24j2TpylQM9ppIDslSVxP/nnuL4Cfv6RvSE sLXX/9y4KPHSRXWcpUHZwjQ5JoV7GqosfgE3zAOaiLkIiNMJ6Dgn6zzEZj9FE6xBEj MRcaHIFM1dFqg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E71FC18006E for ; Sun, 28 Apr 2024 12:50:12 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 ; Sun, 28 Apr 2024 12:50:12 +0000 (UTC) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-34ce52fb920so441408f8f.3 for ; Sun, 28 Apr 2024 05:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714308568; x=1714913368; darn=lists.php.net; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=GJUwoNis3toordK/XhyZ4FaWCYAQgIpOPwHAyV5PD8M=; b=KWGFKSv/67AvBFSOhcH7cc4a4ZpbwTqQHLz7IIhOx4J6FJdb8aSIliFPvoQMfUrTOf uHQ/D13T0p9Go1iQphahd/kdaE4Rjxh9WigZs4mhmvhD+BHCQqjioFPPVP4HZrzUsNNT uQVzQrWcTa1qH9dN30P7rt8Q6BxvjgWYawrAj6lsIIdldJcp7X2iPlfwvacdiq6ybIC8 TKRx0+DLhN8i8ApImNn6MJwZlkvWpycUXxWgETwCS+7ITMe8KwhnBfUKzDKmKOhH6cxA dcL4Mo6J9++VqAOxXpZHymns/gUD0fyuW9urgTiWxNfvSLSQCIH8wIfUUg8oys0PvL7B IZfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714308568; x=1714913368; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GJUwoNis3toordK/XhyZ4FaWCYAQgIpOPwHAyV5PD8M=; b=LFZU+B+l5wRNcVZrm5fS4FzHoH/7KQiuK+xWveuamPX8DaDHxgZ8JilQi3unPLuIwu SCPuf52aR6Tb4lkFr5tu8rDxFxLLEntl69tZhYnv8iTzabGyseVoXUoN/DGb3JofEOUK I+RuUgulISwl7cZJbmREtqHdE0KTwOMo01nWJ+MdPRQkrog5alL622NmrhnFmHfGJziu hjqIfoKUUJH3jg01w4+eEGYwIVjopTRXTGqQ7/Z1RnV41bk9//L8AUP/9LS9H76wW4AE lBY5lAMF1gmmj1ZBhkFGl/sBz3zWn3WR+MS0fR5/XaVCgvXZ1xrwE4bgJn55UwY0f6PK 9F+A== X-Gm-Message-State: AOJu0Ywe3x41qN7kWkScv/u90v/JqlO7KArbnu033pis4PTy2YLsjvj/ 5LHkCiRnRLtGuaw1Yfd59zewUr5yY+DzTFbZHs6UxsCFZA+1/CatV3OihA== X-Google-Smtp-Source: AGHT+IH7aqGtw7dKycy2irBrs5HpryVVZ+84aye4p96WZ77PXoC9BpJOoDk4jOTO+zAOfX8eJvWOiA== X-Received: by 2002:a5d:6108:0:b0:34c:719e:67a5 with SMTP id v8-20020a5d6108000000b0034c719e67a5mr3892528wrt.9.1714308568106; Sun, 28 Apr 2024 05:49:28 -0700 (PDT) Received: from [192.168.0.102] (178-117-134-240.access.telenet.be. [178.117.134.240]) by smtp.gmail.com with ESMTPSA id q2-20020adff942000000b00346bda84bf9sm27378726wrr.78.2024.04.28.05.49.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Apr 2024 05:49:27 -0700 (PDT) Message-ID: <4cc04091-6060-4b91-8d77-41332bd644b6@gmail.com> Date: Sun, 28 Apr 2024 14:47:36 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: PHP internals Subject: [PHP-DEV] ext-dom innerHTML Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) Hi internals I'm working on implementing new ext-dom features for PHP 8.4. Among them is support for the $innerHTML property. It works, but I was wondering how to handle error reporting with this property from a developer PoV. Normally when you parse an XML/HTML document using the DOM extension you either receive warnings or get a list of error objects depending on whether internal error handling is enabled (using libxml_use_internal_errors). Error reporting can be disabled by passing in LIBXML_NOERROR to the parser. Note that these errors can either be hard errors (e.g. parsing XML without recovery enabled), or soft errors (e.g. parsing HTML which has recovery rules). Because $innerHTML is a property, you can't pass the LIBXML_NOERROR option. Therefore, it's not possible to suppress potential errors, except when using the @ operator but that doesn't stop the error reporting when internal error handling is enabled. The current solution I've been thinking about is inheriting the LIBXML_NOERROR option if it was used to parse the document initially. However, that won't work when a document was created without using a parser, e.g. using `XMLDocument::createEmpty()` or `$dom->implementation->createDocument(...)`. It's worth noting that browsers when parsing XML in innerHTML always emit errors on malformed XML, with no option to disable it. Looking forward to hear opinions on this. Kind regards Niels