Commit 72ef56a5ad7 for php

commit 72ef56a5ad7c8f394582d3559a066dd5a433f12d
Merge: 95bca157ab9 dc929937558
Author: David Carlier <devnexen@gmail.com>
Date:   Sat Nov 21 13:05:07 2026 +0000

    Merge branch 'PHP-8.6'

    * PHP-8.6:
      ext/dom: querySelector() rejects a non-ASCII leading identifier.

    # Conflicts:
    #       ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch
    #       ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch
    #       ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch
    #       ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch
    #       ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch
    #       ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch
    #       ext/lexbor/patches/0007-Add-lxb_url_is_special-to-the-public-API-362.patch
    #       ext/lexbor/patches/0008-URL-fixed-setters-for-empty-hosts.patch
    #       ext/lexbor/patches/0009-URL-fixed-uninitialized-memory-in-the-path-buffer-gr.patch
    #       ext/lexbor/patches/0010-Fix-parsing-for-URL-containing-empty-host-and-userin.patch
    #       ext/lexbor/patches/0011-Percent-encode-the-caret-in-the-path.patch
    #       ext/lexbor/patches/0012-URL-added-public-IPv6-parser.patch
    #       ext/lexbor/patches/0013-URL-added-public-percent-encoder-API.patch
    #       ext/lexbor/patches/0014-CSS-fixed-heap-buffer-overflow-in-lexbor-contains-pa.patch
    #       ext/lexbor/patches/0015-Encoding-fixed-buffer-overflows-in-malformed-decode-.patch
    #       ext/lexbor/patches/0016-URL-fixed-tail-pointer-in-URLSearchParams-for-delimi.patch
    #       ext/lexbor/patches/0017-URL-Fix-parsing-of-usernames-containing.patch
    #       ext/lexbor/patches/0018-Unicode-fixed-uninitialized-memory-in-IDNA-buffer-gr.patch
    #       ext/lexbor/patches/0019-URL-encode-opaque-path-spaces-before-query-and-fragm.patch
    #       ext/lexbor/patches/0020-URL-Fix-lxb_url_serialize_fragment-without-a-query-4.patch
    #       ext/lexbor/patches/0021-URL-expose-component-reset-functions.-415.patch
    #       ext/lexbor/patches/0022-URL-Fix-parsing-of-query-and-fragment-after-a-dot-co.patch
    #       ext/lexbor/patches/0023-URL-Keep-replacement-file-drive-paths-hierarchical-4.patch
    #       ext/lexbor/patches/0024-URL-normalize-output-encoding-for-percent-encoding.patch
    #       ext/lexbor/patches/0025-HTML-fixed-crash-use-after-free-and-leaks-on-allocat.patch

diff --cc ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch
index 426e3fc312d,a3ae53aeb4c..0aaf062bd1c
--- a/ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch
+++ b/ext/lexbor/patches/0001-Expose-line-and-column-information-for-use-in-PHP.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Sat, 26 Aug 2023 15:08:59 +0200
- Subject: [PATCH 01/27] Expose line and column information for use in PHP
 -Subject: [PATCH 01/29] Expose line and column information for use in PHP
++Subject: [PATCH 01/31] Expose line and column information for use in PHP

  ---
   source/lexbor/dom/interfaces/node.h  |  2 ++
diff --cc ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch
index c875206b47c,9015cb14a52..ca9f75f4c3c
--- a/ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch
+++ b/ext/lexbor/patches/0002-Track-implied-added-nodes-for-options-use-in-PHP.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Mon, 14 Aug 2023 20:18:51 +0200
- Subject: [PATCH 02/27] Track implied added nodes for options use in PHP
 -Subject: [PATCH 02/29] Track implied added nodes for options use in PHP
++Subject: [PATCH 02/31] Track implied added nodes for options use in PHP

  ---
   source/lexbor/html/tree.h                            | 3 +++
diff --cc ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch
index 47d66de4f48,1137f3c75d9..19c260062d4
--- a/ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch
+++ b/ext/lexbor/patches/0003-Patch-utilities-and-data-structure-to-be-able-to-gen.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Thu, 24 Aug 2023 22:57:48 +0200
- Subject: [PATCH 03/27] Patch utilities and data structure to be able to
 -Subject: [PATCH 03/29] Patch utilities and data structure to be able to
++Subject: [PATCH 03/31] Patch utilities and data structure to be able to
   generate smaller lookup tables

  Changed the generation script to check if everything fits in 32-bits.
diff --cc ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch
index 30fbff33ba8,450d29327d1..c913a17b623
--- a/ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch
+++ b/ext/lexbor/patches/0004-Remove-unused-upper-case-tag-static-data.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Wed, 29 Nov 2023 21:26:47 +0100
- Subject: [PATCH 04/27] Remove unused upper case tag static data
 -Subject: [PATCH 04/29] Remove unused upper case tag static data
++Subject: [PATCH 04/31] Remove unused upper case tag static data

  ---
   source/lexbor/tag/res.h | 2 ++
diff --cc ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch
index f25593922c5,6bcb36d6f6e..f1d7bb312a6
--- a/ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch
+++ b/ext/lexbor/patches/0005-Shrink-size-of-static-binary-search-tree.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Wed, 29 Nov 2023 21:29:31 +0100
- Subject: [PATCH 05/27] Shrink size of static binary search tree
 -Subject: [PATCH 05/29] Shrink size of static binary search tree
++Subject: [PATCH 05/31] Shrink size of static binary search tree

  This also makes it more efficient on the data cache.
  ---
diff --cc ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch
index 874e0c216a9,f9236836703..d1bdf91ac29
--- a/ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch
+++ b/ext/lexbor/patches/0006-Patch-out-unused-CSS-style-code.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
  Date: Sun, 7 Jan 2024 21:59:28 +0100
- Subject: [PATCH 06/27] Patch out unused CSS style code
 -Subject: [PATCH 06/29] Patch out unused CSS style code
++Subject: [PATCH 06/31] Patch out unused CSS style code

  ---
   source/lexbor/css/rule.h | 2 ++
diff --cc ext/lexbor/patches/0007-Add-lxb_url_is_special-to-the-public-API-362.patch
index 43bbdd71c1c,54b48ecceb6..ff8a5ebaa18
--- a/ext/lexbor/patches/0007-Add-lxb_url_is_special-to-the-public-API-362.patch
+++ b/ext/lexbor/patches/0007-Add-lxb_url_is_special-to-the-public-API-362.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Sun, 17 May 2026 22:17:14 +0200
- Subject: [PATCH 07/27] Add lxb_url_is_special() to the public API (#362)
 -Subject: [PATCH 07/29] Add lxb_url_is_special() to the public API (#362)
++Subject: [PATCH 07/31] Add lxb_url_is_special() to the public API (#362)

  As https://wiki.php.net/rfc/uri_followup#uri_type_detection relies on this information.
  ---
diff --cc ext/lexbor/patches/0008-URL-fixed-setters-for-empty-hosts.patch
index 121a5ee3a3b,e994f62a6a7..72628cc4ca3
--- a/ext/lexbor/patches/0008-URL-fixed-setters-for-empty-hosts.patch
+++ b/ext/lexbor/patches/0008-URL-fixed-setters-for-empty-hosts.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Fri, 26 Jun 2026 18:55:56 +0300
- Subject: [PATCH 08/27] URL: fixed setters for empty hosts.
 -Subject: [PATCH 08/29] URL: fixed setters for empty hosts.
++Subject: [PATCH 08/31] URL: fixed setters for empty hosts.
  MIME-Version: 1.0
  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: 8bit
diff --cc ext/lexbor/patches/0009-URL-fixed-uninitialized-memory-in-the-path-buffer-gr.patch
index 0683fa1c0d8,4815378bb26..877fd28797c
--- a/ext/lexbor/patches/0009-URL-fixed-uninitialized-memory-in-the-path-buffer-gr.patch
+++ b/ext/lexbor/patches/0009-URL-fixed-uninitialized-memory-in-the-path-buffer-gr.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Fri, 5 Jun 2026 22:13:32 +0300
- Subject: [PATCH 09/27] URL: fixed uninitialized memory in the path buffer
 -Subject: [PATCH 09/29] URL: fixed uninitialized memory in the path buffer
++Subject: [PATCH 09/31] URL: fixed uninitialized memory in the path buffer
   growth.

  When a path was long enough to outgrow the on-stack buffer, the first
diff --cc ext/lexbor/patches/0010-Fix-parsing-for-URL-containing-empty-host-and-userin.patch
index 42d7220cf89,3760e28b8e3..3e2e17976da
--- a/ext/lexbor/patches/0010-Fix-parsing-for-URL-containing-empty-host-and-userin.patch
+++ b/ext/lexbor/patches/0010-Fix-parsing-for-URL-containing-empty-host-and-userin.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Thu, 9 Jul 2026 21:51:05 +0200
- Subject: [PATCH 10/27] Fix parsing for URL containing empty host and userinfo
 -Subject: [PATCH 10/29] Fix parsing for URL containing empty host and userinfo
++Subject: [PATCH 10/31] Fix parsing for URL containing empty host and userinfo

  The returned error code (LXB_URL_ERROR_TYPE_INVALID_CREDENTIALS) apparently contradicts the specification:

diff --cc ext/lexbor/patches/0011-Percent-encode-the-caret-in-the-path.patch
index a06cf0f709b,41d54b1b015..e70d35cf947
--- a/ext/lexbor/patches/0011-Percent-encode-the-caret-in-the-path.patch
+++ b/ext/lexbor/patches/0011-Percent-encode-the-caret-in-the-path.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Fri, 10 Jul 2026 22:31:16 +0200
- Subject: [PATCH 11/27] Percent-encode the caret in the path
 -Subject: [PATCH 11/29] Percent-encode the caret in the path
++Subject: [PATCH 11/31] Percent-encode the caret in the path

  The caret (^) is part of the path percent-encode set:

diff --cc ext/lexbor/patches/0012-URL-added-public-IPv6-parser.patch
index 14b3bc24f2f,bb5846d63de..bb01c2c771c
--- a/ext/lexbor/patches/0012-URL-added-public-IPv6-parser.patch
+++ b/ext/lexbor/patches/0012-URL-added-public-IPv6-parser.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Wed, 12 Aug 2026 23:29:20 +0300
- Subject: [PATCH 12/27] URL: added public IPv6 parser.
 -Subject: [PATCH 12/29] URL: added public IPv6 parser.
++Subject: [PATCH 12/31] URL: added public IPv6 parser.
  MIME-Version: 1.0
  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: 8bit
diff --cc ext/lexbor/patches/0013-URL-added-public-percent-encoder-API.patch
index 36c9479d053,7b0f95cc9ea..257764bdcb5
--- a/ext/lexbor/patches/0013-URL-added-public-percent-encoder-API.patch
+++ b/ext/lexbor/patches/0013-URL-added-public-percent-encoder-API.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Thu, 13 Aug 2026 23:29:16 +0300
- Subject: [PATCH 13/27] URL: added public percent-encoder API.
 -Subject: [PATCH 13/29] URL: added public percent-encoder API.
++Subject: [PATCH 13/31] URL: added public percent-encoder API.
  MIME-Version: 1.0
  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: 8bit
diff --cc ext/lexbor/patches/0014-CSS-fixed-heap-buffer-overflow-in-lexbor-contains-pa.patch
index e83be1e9e5b,6a4688e9537..5f9551cc3ca
--- a/ext/lexbor/patches/0014-CSS-fixed-heap-buffer-overflow-in-lexbor-contains-pa.patch
+++ b/ext/lexbor/patches/0014-CSS-fixed-heap-buffer-overflow-in-lexbor-contains-pa.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Fri, 5 Jun 2026 22:34:23 +0300
- Subject: [PATCH 14/27] CSS: fixed heap buffer overflow in :lexbor-contains()
 -Subject: [PATCH 14/29] CSS: fixed heap buffer overflow in :lexbor-contains()
++Subject: [PATCH 14/31] CSS: fixed heap buffer overflow in :lexbor-contains()
   parsing.

  The contains string buffer was allocated by the size of the string
diff --cc ext/lexbor/patches/0015-Encoding-fixed-buffer-overflows-in-malformed-decode-.patch
index 306e1526a96,78a8038a752..35a6b71ffcb
--- a/ext/lexbor/patches/0015-Encoding-fixed-buffer-overflows-in-malformed-decode-.patch
+++ b/ext/lexbor/patches/0015-Encoding-fixed-buffer-overflows-in-malformed-decode-.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Wed, 10 Jun 2026 19:50:10 +0300
- Subject: [PATCH 15/27] Encoding: fixed buffer overflows in malformed decode
 -Subject: [PATCH 15/29] Encoding: fixed buffer overflows in malformed decode
++Subject: [PATCH 15/31] Encoding: fixed buffer overflows in malformed decode
   replay.

  Fixed out-of-bounds writes in buffering decoders when replacement output
diff --cc ext/lexbor/patches/0016-URL-fixed-tail-pointer-in-URLSearchParams-for-delimi.patch
index 540a3409cae,9f876e4ace9..d65ccfe2098
--- a/ext/lexbor/patches/0016-URL-fixed-tail-pointer-in-URLSearchParams-for-delimi.patch
+++ b/ext/lexbor/patches/0016-URL-fixed-tail-pointer-in-URLSearchParams-for-delimi.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Fri, 5 Jun 2026 21:46:26 +0300
- Subject: [PATCH 16/27] URL: fixed tail pointer in URLSearchParams for
 -Subject: [PATCH 16/29] URL: fixed tail pointer in URLSearchParams for
++Subject: [PATCH 16/31] URL: fixed tail pointer in URLSearchParams for
   delimiter-free query.

  When a query had a single token without '=' or '&' (e.g. "?abc"), the
diff --cc ext/lexbor/patches/0017-URL-Fix-parsing-of-usernames-containing.patch
index 9dad4bbc4dd,c6b4a6015ee..fff4cb7829a
--- a/ext/lexbor/patches/0017-URL-Fix-parsing-of-usernames-containing.patch
+++ b/ext/lexbor/patches/0017-URL-Fix-parsing-of-usernames-containing.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <tim@bastelstu.be>
  Date: Fri, 31 Jul 2026 20:56:18 +0200
- Subject: [PATCH 17/27] URL: Fix parsing of usernames containing `@`
 -Subject: [PATCH 17/29] URL: Fix parsing of usernames containing `@`
++Subject: [PATCH 17/31] URL: Fix parsing of usernames containing `@`

  Fixes lexbor/lexbor#399.
  ---
diff --cc ext/lexbor/patches/0018-Unicode-fixed-uninitialized-memory-in-IDNA-buffer-gr.patch
index 9898b1864f8,4336482563b..dea729e311b
--- a/ext/lexbor/patches/0018-Unicode-fixed-uninitialized-memory-in-IDNA-buffer-gr.patch
+++ b/ext/lexbor/patches/0018-Unicode-fixed-uninitialized-memory-in-IDNA-buffer-gr.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Mon, 7 Sep 2026 22:11:39 +0300
- Subject: [PATCH 18/27] Unicode: fixed uninitialized memory in IDNA buffer
 -Subject: [PATCH 18/29] Unicode: fixed uninitialized memory in IDNA buffer
++Subject: [PATCH 18/31] Unicode: fixed uninitialized memory in IDNA buffer
   growth.

  When an IDNA buffer outgrew the stack allocation, the move to the heap
diff --cc ext/lexbor/patches/0019-URL-encode-opaque-path-spaces-before-query-and-fragm.patch
index b142c05c08e,dfb3f38c5f1..9e464ce8e3f
--- a/ext/lexbor/patches/0019-URL-encode-opaque-path-spaces-before-query-and-fragm.patch
+++ b/ext/lexbor/patches/0019-URL-encode-opaque-path-spaces-before-query-and-fragm.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Fri, 11 Sep 2026 21:58:45 +0200
- Subject: [PATCH 19/27] URL: encode opaque path spaces before query and
 -Subject: [PATCH 19/29] URL: encode opaque path spaces before query and
++Subject: [PATCH 19/31] URL: encode opaque path spaces before query and
   fragment. (#405)
  MIME-Version: 1.0
  Content-Type: text/plain; charset=UTF-8
diff --cc ext/lexbor/patches/0020-URL-Fix-lxb_url_serialize_fragment-without-a-query-4.patch
index 0451921ab11,4efb0b51bb6..3d288e8a06a
--- a/ext/lexbor/patches/0020-URL-Fix-lxb_url_serialize_fragment-without-a-query-4.patch
+++ b/ext/lexbor/patches/0020-URL-Fix-lxb_url_serialize_fragment-without-a-query-4.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <tim@tideways-gmbh.com>
  Date: Fri, 11 Sep 2026 22:45:33 +0200
- Subject: [PATCH 20/27] URL: Fix `lxb_url_serialize_fragment()` without a query
 -Subject: [PATCH 20/29] URL: Fix `lxb_url_serialize_fragment()` without a query
++Subject: [PATCH 20/31] URL: Fix `lxb_url_serialize_fragment()` without a query
   (#410)

  The `lxb_url_serialize_fragment()` function checked if the query contained data
diff --cc ext/lexbor/patches/0021-URL-expose-component-reset-functions.-415.patch
index bb6f560a2fd,b4fb0ded012..c6d7e33d5bd
--- a/ext/lexbor/patches/0021-URL-expose-component-reset-functions.-415.patch
+++ b/ext/lexbor/patches/0021-URL-expose-component-reset-functions.-415.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Tue, 22 Sep 2026 22:20:28 +0200
- Subject: [PATCH 21/27] URL: expose component reset functions. (#415)
 -Subject: [PATCH 21/29] URL: expose component reset functions. (#415)
++Subject: [PATCH 21/31] URL: expose component reset functions. (#415)

  * URL: expose component reset functions.

diff --cc ext/lexbor/patches/0022-URL-Fix-parsing-of-query-and-fragment-after-a-dot-co.patch
index 44ee0b528f9,b6fd62e7ffd..56609dfffdc
--- a/ext/lexbor/patches/0022-URL-Fix-parsing-of-query-and-fragment-after-a-dot-co.patch
+++ b/ext/lexbor/patches/0022-URL-Fix-parsing-of-query-and-fragment-after-a-dot-co.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= <tim@tideways-gmbh.com>
  Date: Sat, 26 Sep 2026 18:41:05 +0200
- Subject: [PATCH 22/27] URL: Fix parsing of query and fragment after a
 -Subject: [PATCH 22/29] URL: Fix parsing of query and fragment after a
++Subject: [PATCH 22/31] URL: Fix parsing of query and fragment after a
   dot-component in path (#411)
  MIME-Version: 1.0
  Content-Type: text/plain; charset=UTF-8
diff --cc ext/lexbor/patches/0023-URL-Keep-replacement-file-drive-paths-hierarchical-4.patch
index 62a33e819fd,7cb64b3cf67..f77e1d99f4d
--- a/ext/lexbor/patches/0023-URL-Keep-replacement-file-drive-paths-hierarchical-4.patch
+++ b/ext/lexbor/patches/0023-URL-Keep-replacement-file-drive-paths-hierarchical-4.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= <kocsismate@woohoolabs.com>
  Date: Mon, 21 Sep 2026 20:01:43 +0200
- Subject: [PATCH 23/27] URL: Keep replacement file drive paths hierarchical
 -Subject: [PATCH 23/29] URL: Keep replacement file drive paths hierarchical
++Subject: [PATCH 23/31] URL: Keep replacement file drive paths hierarchical
   (#423)

  WHATWG file state (https://url.spec.whatwg.org/#file-state) step 4.4.3.2 resets the path to an empty list. Do not mark it opaque, as that makes subsequent pathname updates silently do nothing.
diff --cc ext/lexbor/patches/0024-URL-normalize-output-encoding-for-percent-encoding.patch
index d47fabc0c6f,22f100b4e7f..ba9e730fd3f
--- a/ext/lexbor/patches/0024-URL-normalize-output-encoding-for-percent-encoding.patch
+++ b/ext/lexbor/patches/0024-URL-normalize-output-encoding-for-percent-encoding.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: Alexander Borisov <lex.borisov@gmail.com>
  Date: Thu, 24 Sep 2026 15:05:51 +0300
- Subject: [PATCH 24/27] URL: normalize output encoding for percent-encoding.
 -Subject: [PATCH 24/29] URL: normalize output encoding for percent-encoding.
++Subject: [PATCH 24/31] URL: normalize output encoding for percent-encoding.

  ---
   source/lexbor/url/url.c | 34 +++++++++++++++++++++++++---------
diff --cc ext/lexbor/patches/0025-HTML-fixed-crash-use-after-free-and-leaks-on-allocat.patch
index 7b45ed50031,1498d3ae38a..70bb568b8eb
--- a/ext/lexbor/patches/0025-HTML-fixed-crash-use-after-free-and-leaks-on-allocat.patch
+++ b/ext/lexbor/patches/0025-HTML-fixed-crash-use-after-free-and-leaks-on-allocat.patch
@@@ -1,7 -1,7 +1,7 @@@
  From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  From: sjanel <67502353+sjanel@users.noreply.github.com>
  Date: Wed, 11 Nov 2026 20:26:42 +0100
- Subject: [PATCH 25/27] HTML: fixed crash, use-after-free and leaks on
 -Subject: [PATCH 25/29] HTML: fixed crash, use-after-free and leaks on
++Subject: [PATCH 25/31] HTML: fixed crash, use-after-free and leaks on
   allocation failure in document create and parse (#448)

  HTML: fixed crash, use-after-free and leaks on allocation failure.
diff --cc ext/lexbor/patches/0026-Core-fixed-allocation-and-move-sizes-in-lexbor_array.patch
index 5a4bcb4103c,00000000000..ed54805953f
mode 100644,000000..100644
--- a/ext/lexbor/patches/0026-Core-fixed-allocation-and-move-sizes-in-lexbor_array.patch
+++ b/ext/lexbor/patches/0026-Core-fixed-allocation-and-move-sizes-in-lexbor_array.patch
@@@ -1,52 -1,0 +1,52 @@@
 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 +From: Nicolas Grekas <nicolas.grekas@gmail.com>
 +Date: Mon, 28 Sep 2026 21:25:27 +0200
- Subject: [PATCH 26/27] Core: fixed allocation and move sizes in
++Subject: [PATCH 26/31] Core: fixed allocation and move sizes in
 + lexbor_array_obj_t. (#428)
 +
 +lexbor_array_obj_init() and lexbor_array_obj_expand() multiplied the
 +number of bytes they need by sizeof(uint8_t *), so they allocated 8
 +times too much memory on 64-bit platforms. lexbor_array_obj_delete()
 +moved 8 times the bytes of the remaining entries too, which only stayed
 +within bounds thanks to the oversized allocation.
 +
 +Added tests for the allocated sizes and for the entries after the last
 +one being left untouched by lexbor_array_obj_delete().
 +---
 + source/lexbor/core/array_obj.c | 9 +++------
 + 1 file changed, 3 insertions(+), 6 deletions(-)
 +
 +diff --git a/source/lexbor/core/array_obj.c b/source/lexbor/core/array_obj.c
 +index 79a4c3a..8cceaf9 100644
 +--- a/source/lexbor/core/array_obj.c
 ++++ b/source/lexbor/core/array_obj.c
 +@@ -29,8 +29,7 @@ lexbor_array_obj_init(lexbor_array_obj_t *array,
 +     array->size = size;
 +     array->struct_size = struct_size;
 +
 +-    array->list = lexbor_malloc(sizeof(uint8_t *)
 +-                                * (array->size * struct_size));
 ++    array->list = lexbor_malloc(array->size * struct_size);
 +     if (array->list == NULL) {
 +         return LXB_STATUS_ERROR_MEMORY_ALLOCATION;
 +     }
 +@@ -77,8 +76,7 @@ lexbor_array_obj_expand(lexbor_array_obj_t *array, size_t up_to)
 +
 +     new_size = array->length + up_to;
 +
 +-    list = lexbor_realloc(array->list, sizeof(uint8_t *)
 +-                          * (new_size * array->struct_size));
 ++    list = lexbor_realloc(array->list, new_size * array->struct_size);
 +     if (list == NULL) {
 +         return NULL;
 +     }
 +@@ -170,8 +168,7 @@ lexbor_array_obj_delete(lexbor_array_obj_t *array, size_t begin, size_t length)
 +
 +     memmove(&array->list[ begin * array->struct_size ],
 +             &array->list[ end_len * array->struct_size ],
 +-            sizeof(uint8_t *)
 +-            * ((array->length - end_len) * array->struct_size));
 ++            (array->length - end_len) * array->struct_size);
 +
 +     array->length -= length;
 + }
diff --cc ext/lexbor/patches/0027-Core-HTML-reduced-initial-sizes-of-tokenizer-pools-a.patch
index e93001b4495,00000000000..6ca95f27d7f
mode 100644,000000..100644
--- a/ext/lexbor/patches/0027-Core-HTML-reduced-initial-sizes-of-tokenizer-pools-a.patch
+++ b/ext/lexbor/patches/0027-Core-HTML-reduced-initial-sizes-of-tokenizer-pools-a.patch
@@@ -1,87 -1,0 +1,87 @@@
 +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 +From: Nicolas Grekas <nicolas.grekas@gmail.com>
 +Date: Sun, 27 Sep 2026 19:49:58 +0200
- Subject: [PATCH 27/27] Core/HTML: reduced initial sizes of tokenizer pools and
++Subject: [PATCH 27/31] Core/HTML: reduced initial sizes of tokenizer pools and
 + mraw cache.
 +
 +The HTML tokenizer preallocated 4096 tokens and 4096 token attributes,
 +and every lexbor_mraw_t preallocated 512 entries for its cache of freed
 +blocks. A document parser has 7 mraws, so about 1 MB was allocated
 +before parsing a single byte.
 +
 +The tree builder uses a single token, and all these pools grow on
 +demand, so they now start with 16 tokens, 256 attributes and 64 cache
 +entries.
 +
 +The initial sizes can be set at build time by defining
 +LXB_HTML_TKZ_TOKEN_POOL_SIZE, LXB_HTML_TKZ_ATTR_POOL_SIZE and
 +LEXBOR_MRAW_CACHE_SIZE, e.g. with -D compiler flags.
 +
 +This is lexbor/lexbor#427.
 +---
 + source/lexbor/core/mraw.c      |  6 +++++-
 + source/lexbor/html/tokenizer.c | 14 ++++++++++++--
 + 2 files changed, 17 insertions(+), 3 deletions(-)
 +
 +diff --git a/source/lexbor/core/mraw.c b/source/lexbor/core/mraw.c
 +index c990405..30faca6 100644
 +--- a/source/lexbor/core/mraw.c
 ++++ b/source/lexbor/core/mraw.c
 +@@ -11,6 +11,10 @@
 +     #include <sanitizer/asan_interface.h>
 + #endif
 +
 ++#ifndef LEXBOR_MRAW_CACHE_SIZE
 ++    #define LEXBOR_MRAW_CACHE_SIZE 64
 ++#endif
 ++
 +
 + #define lexbor_mraw_meta_set(data, size)                                       \
 +     do {                                                                       \
 +@@ -62,7 +66,7 @@ lexbor_mraw_init(lexbor_mraw_t *mraw, size_t chunk_size)
 +     /* Cache */
 +     mraw->cache = lexbor_bst_create();
 +
 +-    status = lexbor_bst_init(mraw->cache, 512);
 ++    status = lexbor_bst_init(mraw->cache, LEXBOR_MRAW_CACHE_SIZE);
 +     if (status) {
 +         return status;
 +     }
 +diff --git a/source/lexbor/html/tokenizer.c b/source/lexbor/html/tokenizer.c
 +index 1d9f378..2193146 100644
 +--- a/source/lexbor/html/tokenizer.c
 ++++ b/source/lexbor/html/tokenizer.c
 +@@ -20,6 +20,14 @@
 +
 + #define LXB_HTML_TKZ_TEMP_SIZE (4096 * 4)
 +
 ++#ifndef LXB_HTML_TKZ_TOKEN_POOL_SIZE
 ++    #define LXB_HTML_TKZ_TOKEN_POOL_SIZE 16
 ++#endif
 ++
 ++#ifndef LXB_HTML_TKZ_ATTR_POOL_SIZE
 ++    #define LXB_HTML_TKZ_ATTR_POOL_SIZE 256
 ++#endif
 ++
 +
 + enum {
 +     LXB_HTML_TOKENIZER_OPT_TAGS_SELF       = 1 << 0,
 +@@ -63,14 +71,16 @@ lxb_html_tokenizer_init(lxb_html_tokenizer_t *tkz)
 +
 +     tkz->dobj_token = lexbor_dobject_create();
 +     status = lexbor_dobject_init(tkz->dobj_token,
 +-                                 4096, sizeof(lxb_html_token_t));
 ++                                 LXB_HTML_TKZ_TOKEN_POOL_SIZE,
 ++                                 sizeof(lxb_html_token_t));
 +     if (status != LXB_STATUS_OK) {
 +         return status;
 +     }
 +
 +     /* Init Token Attributes */
 +     tkz->dobj_token_attr = lexbor_dobject_create();
 +-    status = lexbor_dobject_init(tkz->dobj_token_attr, 4096,
 ++    status = lexbor_dobject_init(tkz->dobj_token_attr,
 ++                                 LXB_HTML_TKZ_ATTR_POOL_SIZE,
 +                                  sizeof(lxb_html_token_attr_t));
 +     if (status != LXB_STATUS_OK) {
 +         return status;
diff --cc ext/lexbor/patches/0028-CSS-Syntax-fixed-non-ASCII-ident-code-point-ranges.patch
index 00000000000,8cb05c63905..02a34b2c57f
mode 000000,100644..100644
--- a/ext/lexbor/patches/0028-CSS-Syntax-fixed-non-ASCII-ident-code-point-ranges.patch
+++ b/ext/lexbor/patches/0028-CSS-Syntax-fixed-non-ASCII-ident-code-point-ranges.patch
@@@ -1,0 -1,78 +1,78 @@@
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+ From: Alexander Borisov <lex.borisov@gmail.com>
+ Date: Sat, 20 Jun 2026 15:39:44 +0400
 -Subject: [PATCH 26/29] CSS::Syntax: fixed non-ASCII ident code point ranges.
++Subject: [PATCH 28/31] CSS::Syntax: fixed non-ASCII ident code point ranges.
+
+ By specification https://drafts.csswg.org/css-syntax/#non-ascii-ident-code-point.
+
+ Per report from Jon Surrell (@sirreal).
+
+ This relates to #382 issue on GitHub.
+ ---
+  source/lexbor/css/syntax/state.c | 41 ++++++++++++++++++++++----------
+  1 file changed, 28 insertions(+), 13 deletions(-)
+
+ diff --git a/source/lexbor/css/syntax/state.c b/source/lexbor/css/syntax/state.c
+ index a93731e..a011c5a 100644
+ --- a/source/lexbor/css/syntax/state.c
+ +++ b/source/lexbor/css/syntax/state.c
+ @@ -165,31 +165,46 @@ lxb_css_syntax_state_non_ascii(lxb_codepoint_t cp)
+      /* This code is generated by the file utils/lexbor/css/syntax/non_ascii.pl */
+
+      /* Begin */
+ -    if (cp <= 0x2FEF) {
+ -        if (cp <= 0x1FFF) {
+ -            if (cp >= 0x00F8 && cp < 0x037D) {
+ +    if (cp <= 0x218F) {
+ +        if (cp <= 0x00F6) {
+ +            if (cp >= 0x00B7 && cp <= 0x00B7) {
+                  return true;
+              }
+ -            else if (cp >= 0x037F) {
+ -                return true;
+ +            else if (cp >= 0x00C0) {
+ +                if (cp <= 0x00D6) {
+ +                    return true;
+ +                }
+ +                else if (cp >= 0x00D8) {
+ +                    return true;
+ +                }
+              }
+          }
+ -        else if (cp >= 0x2070) {
+ -            if (cp <= 0x218F) {
+ +        else if (cp >= 0x00F8) {
+ +            if (cp <= 0x037D) {
+                  return true;
+              }
+ -            else if (cp >= 0x2C00) {
+ -                return true;
+ +            else if (cp >= 0x037F) {
+ +                if (cp <= 0x1FFF) {
+ +                    return true;
+ +                }
+ +                else if (cp >= 0x2070) {
+ +                    return true;
+ +                }
+              }
+          }
+      }
+ -    else if (cp >= 0x3001) {
+ +    else if (cp >= 0x2C00) {
+          if (cp <= 0xFDCF) {
+ -            if (cp <= 0xDFFF) {
+ +            if (cp <= 0x2FEF) {
+                  return true;
+              }
+ -            else if (cp >= 0xF900) {
+ -                return true;
+ +            else if (cp >= 0x3001) {
+ +                if (cp <= 0xDFFF) {
+ +                    return true;
+ +                }
+ +                else if (cp >= 0xF900) {
+ +                    return true;
+ +                }
+              }
+          }
+          else if (cp >= 0xFDF0) {
diff --cc ext/lexbor/patches/0029-iCSS-Syntax-fixed-U-FFFD-replacement-boundaries-for-.patch
index 00000000000,fff0427e08c..62eff38485d
mode 000000,100644..100644
--- a/ext/lexbor/patches/0029-iCSS-Syntax-fixed-U-FFFD-replacement-boundaries-for-.patch
+++ b/ext/lexbor/patches/0029-iCSS-Syntax-fixed-U-FFFD-replacement-boundaries-for-.patch
@@@ -1,0 -1,201 +1,201 @@@
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+ From: Alexander Borisov <lex.borisov@gmail.com>
+ Date: Wed, 8 Jul 2026 20:10:47 +0300
 -Subject: [PATCH 27/29] iCSS::Syntax: fixed U+FFFD replacement boundaries for
++Subject: [PATCH 29/31] iCSS::Syntax: fixed U+FFFD replacement boundaries for
+  UTF-8.
+
+ The tokenizer replaced ill-formed UTF-8 with U+FFFD at boundaries that do
+ not match the specification and browsers. A truncated sequence with valid
+ continuation bytes (E2 8C) produced two U+FFFD instead of one, and a UTF-8
+ encoded surrogate (ED A0 80) produced one U+FFFD instead of three.
+
+ By specification, each maximal subpart of an ill-formed subsequence must
+ be replaced with a single U+FFFD:
+ https://drafts.csswg.org/css-syntax/#input-byte-stream
+ https://encoding.spec.whatwg.org/#utf-8-decoder
+
+ Per report from Jon Surrell (@sirreal).
+
+ This closes #390 issue on GitHub.
+ ---
+  source/lexbor/css/syntax/state.c | 129 +++++++++----------------------
+  1 file changed, 38 insertions(+), 91 deletions(-)
+
+ diff --git a/source/lexbor/css/syntax/state.c b/source/lexbor/css/syntax/state.c
+ index a011c5a..abcf930 100644
+ --- a/source/lexbor/css/syntax/state.c
+ +++ b/source/lexbor/css/syntax/state.c
+ @@ -67,21 +67,13 @@
+      }
+
+  #define LXB_CSS_SYNTAX_UTF_8_UP_80_BLOCK(tkz, begin, data, end)               \
+ +        const lxb_char_t *_bad = data;                                        \
+          lxb_codepoint_t cp = lxb_css_syntax_state_decode_utf_8_up_80(&data,   \
+                                                                       end);    \
+                                                                                \
+          if (cp == LXB_CSS_SYNTAX_ERROR_CODEPOINT) {                           \
+ -            lxb_css_syntax_buffer_append_m(tkz, begin, data - begin);         \
+ -            /* U+FFFD REPLACEMENT CHARACTER */                                \
+ -            lxb_css_syntax_buffer_append_m(tkz, "\uFFFD",                     \
+ -                                           lxb_css_syntax_replacement_length);\
+ -            data += 1;                                                        \
+ -            begin = data;                                                     \
+ -        }                                                                     \
+ -        /* Surrogate U+D800 to U+DFFF. */                                     \
+ -        else if (cp >= 0xD800 && cp <= 0xDFFF) {                              \
+ -            lxb_css_syntax_buffer_append_m(tkz, begin,                        \
+ -                                           (data - begin) - 3);               \
+ +            /* Flush the run before the ill-formed sequence, then U+FFFD. */  \
+ +            lxb_css_syntax_buffer_append_m(tkz, begin, _bad - begin);         \
+              /* U+FFFD REPLACEMENT CHARACTER */                                \
+              lxb_css_syntax_buffer_append_m(tkz, "\uFFFD",                     \
+                                             lxb_css_syntax_replacement_length);\
+ @@ -580,14 +572,6 @@ lxb_css_syntax_state_string(lxb_css_syntax_tokenizer_t *tkz, lxb_css_syntax_toke
+                              cp = lxb_css_syntax_state_decode_utf_8_up_80(&data, end);
+
+                              if (cp == LXB_CSS_SYNTAX_ERROR_CODEPOINT) {
+ -                                /* U+FFFD REPLACEMENT CHARACTER */
+ -                                lxb_css_syntax_buffer_append_m(tkz, "\uFFFD",
+ -                                                               lxb_css_syntax_replacement_length);
+ -                                data += 1;
+ -                                begin = data;
+ -                            }
+ -                            /* Surrogate U+D800 to U+DFFF. */
+ -                            else if (cp >= 0xD800 && cp <= 0xDFFF) {
+                                  /* U+FFFD REPLACEMENT CHARACTER */
+                                  lxb_css_syntax_buffer_append_m(tkz, "\uFFFD",
+                                                                 lxb_css_syntax_replacement_length);
+ @@ -1785,98 +1769,61 @@ static lxb_codepoint_t
+  lxb_css_syntax_state_decode_utf_8_up_80(const lxb_char_t **data,
+                                          const lxb_char_t *end)
+  {
+ -    lxb_char_t ch;
+ +    lxb_char_t ch, lower, upper;
+ +    unsigned needed;
+      const lxb_char_t *p;
+      lxb_codepoint_t cp;
+
+ +    /*
+ +     * WHATWG UTF-8 decoder: https://encoding.spec.whatwg.org/#utf-8-decoder
+ +     */
+ +
+      p = *data;
+ -    ch = *p;
+ +    ch = *p++;
+
+      if (ch <= 0xDF) {
+ -        if (ch < 0xC2 || p + 1 >= end) {
+ +        if (ch < 0xC2) {
+ +            *data = p;
+              return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+          }
+
+ +        needed = 1;
+ +        lower = 0x80;
+ +        upper = 0xBF;
+          cp = ch & 0x1F;
+ -
+ -        if (p[1] < 0x80 || p[1] > 0xBF) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        cp = (cp << 6) | (p[1] & 0x3F);
+ -
+ -        *data += 2;
+      }
+ -    else if (ch < 0xF0) {
+ +    else if (ch <= 0xEF) {
+ +        needed = 2;
+ +        lower = (ch == 0xE0) ? 0xA0 : 0x80;
+ +        upper = (ch == 0xED) ? 0x9F : 0xBF;
+          cp = ch & 0x0F;
+ -
+ -        if (p + 2 >= end) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        if (ch == 0xE0) {
+ -            if (p[1] < 0xA0 || p[1] > 0xBF) {
+ -                return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -            }
+ -        }
+ -
+ -        /*
+ -         * We returning surrogate pair!
+ -         */
+ -/*
+ -        else if (ch == 0xED) {
+ -            if (p[1] < 0x80 || p[1] > 0x9F) {
+ -                return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -            }
+ -        }
+ - */
+ -        else if (p[1] < 0x80 || p[1] > 0xBF) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        if (p[2] < 0x80 || p[2] > 0xBF) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        cp = (cp << 6) | (p[1] & 0x3F);
+ -        cp = (cp << 6) | (p[2] & 0x3F);
+ -
+ -        *data += 3;
+      }
+ -    else if (ch < 0xF5) {
+ +    else if (ch <= 0xF4) {
+ +        needed = 3;
+ +        lower = (ch == 0xF0) ? 0x90 : 0x80;
+ +        upper = (ch == 0xF4) ? 0x8F : 0xBF;
+          cp = ch & 0x07;
+ +    }
+ +    else {
+ +        /* 0xF5..0xFF: an invalid lead byte. */
+ +        *data = p;
+ +        return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ +    }
+
+ -        if (p + 3 >= end) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        if (ch == 0xF0) {
+ -            if (p[1] < 0x90 || p[1] > 0xBF) {
+ -                return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -            }
+ -        }
+ -        else if (ch == 0xF4) {
+ -            if (p[1] < 0x80 || p[1] > 0x8F) {
+ -                return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -            }
+ -        }
+ -        else if (p[1] < 0x80 || p[1] > 0xBF) {
+ -            return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ -        }
+ -
+ -        if ((p[2] < 0x80 || p[2] > 0xBF) || (p[3] < 0x80 || p[3] > 0xBF)) {
+ +    do {
+ +        if (p >= end || *p < lower || *p > upper) {
+ +            *data = p;
+              return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+          }
+
+ -        cp = (cp << 6) | (p[1] & 0x3F);
+ -        cp = (cp << 6) | (p[2] & 0x3F);
+ -        cp = (cp << 6) | (p[3] & 0x3F);
+ +        cp = (cp << 6) | (*p++ & 0x3F);
+
+ -        *data += 4;
+ -    }
+ -    else {
+ -        return LXB_CSS_SYNTAX_ERROR_CODEPOINT;
+ +        lower = 0x80;
+ +        upper = 0xBF;
+      }
+ +    while (--needed != 0);
+ +
+ +    *data = p;
+
+      return cp;
+  }
diff --cc ext/lexbor/patches/0030-CSS-Syntax-fixed-UTF-8-escapes-in-ident-sequences.patch
index 00000000000,7c57e923a23..cd7070e18c9
mode 000000,100644..100644
--- a/ext/lexbor/patches/0030-CSS-Syntax-fixed-UTF-8-escapes-in-ident-sequences.patch
+++ b/ext/lexbor/patches/0030-CSS-Syntax-fixed-UTF-8-escapes-in-ident-sequences.patch
@@@ -1,0 -1,60 +1,60 @@@
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+ From: Alexander Borisov <lex.borisov@gmail.com>
+ Date: Thu, 9 Jul 2026 23:24:05 +0300
 -Subject: [PATCH 28/29] CSS::Syntax: fixed UTF-8 escapes in ident sequences.
++Subject: [PATCH 30/31] CSS::Syntax: fixed UTF-8 escapes in ident sequences.
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset=UTF-8
+ Content-Transfer-Encoding: 8bit
+
+ Non-hex escapes consumed only the first byte of a UTF-8 sequence and used it
+ as a code point. Because of this, "a\é" became "aÃ�" instead of "aé".
+ The same issue affected unquoted URL tokens.
+ ---
+  source/lexbor/css/syntax/state.c | 20 +++++++++++++++++++-
+  1 file changed, 19 insertions(+), 1 deletion(-)
+
+ diff --git a/source/lexbor/css/syntax/state.c b/source/lexbor/css/syntax/state.c
+ index abcf930..a1db76a 100644
+ --- a/source/lexbor/css/syntax/state.c
+ +++ b/source/lexbor/css/syntax/state.c
+ @@ -628,6 +628,17 @@ lxb_css_syntax_state_hash(lxb_css_syntax_tokenizer_t *tkz,
+          return lxb_css_syntax_state_delim_set(token, data - 1, '#');
+      }
+
+ +    if (*data >= 0x80) {
+ +        begin = data;
+ +
+ +        if (lxb_css_syntax_state_start_ident_utf_8_80(&data, end)) {
+ +            data = begin;
+ +            goto hash;
+ +        }
+ +
+ +        return lxb_css_syntax_state_delim_set(token, begin - 1, '#');
+ +    }
+ +
+      if (lxb_css_syntax_res_name_map[*data] == 0x00) {
+          if (*data == 0x00) {
+              goto hash;
+ @@ -1201,6 +1212,7 @@ lxb_css_syntax_state_consume_ident(lxb_css_syntax_tokenizer_t *tkz,
+          else {
+              LXB_CSS_SYNTAX_UTF_8_UP_80_BLOCK(tkz, begin, data, end)
+              else if (!lxb_css_syntax_state_non_ascii(cp)) {
+ +                data = _bad;
+                  break;
+              }
+          }
+ @@ -1629,7 +1641,13 @@ lxb_css_syntax_state_escaped(lxb_css_syntax_tokenizer_t *tkz,
+
+          if (lexbor_str_res_map_hex[*data] == 0xFF) {
+              if (count == 0) {
+ -                cp = (lxb_codepoint_t) *data++;
+ +                if (*data < 0x80) {
+ +                    cp = (lxb_codepoint_t) *data++;
+ +                }
+ +                else {
+ +                    cp = lxb_css_syntax_state_decode_utf_8_up_80(&data, end);
+ +                }
+ +
+                  goto done;
+              }
+
diff --cc ext/lexbor/patches/0031-CSS-Syntax-fixed-non-ASCII-ident-code-points.patch
index 00000000000,d979c149f14..695c2bc00c0
mode 000000,100644..100644
--- a/ext/lexbor/patches/0031-CSS-Syntax-fixed-non-ASCII-ident-code-points.patch
+++ b/ext/lexbor/patches/0031-CSS-Syntax-fixed-non-ASCII-ident-code-points.patch
@@@ -1,0 -1,102 +1,102 @@@
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+ From: Alexander Borisov <lex.borisov@gmail.com>
+ Date: Fri, 10 Jul 2026 00:39:54 +0300
 -Subject: [PATCH 29/29] CSS::Syntax: fixed non-ASCII ident code points.
++Subject: [PATCH 31/31] CSS::Syntax: fixed non-ASCII ident code points.
+
+ Updated generated non-ASCII ident ranges to match CSS Syntax:
+ included U+200C/U+200D and U+203F/U+2040, and stopped the
+ U+3001 range at U+D7FF to exclude surrogate code points.
+ ---
+  source/lexbor/css/syntax/state.c | 45 ++++++++++++++++++--------------
+  1 file changed, 25 insertions(+), 20 deletions(-)
+
+ diff --git a/source/lexbor/css/syntax/state.c b/source/lexbor/css/syntax/state.c
+ index a1db76a..5b694e9 100644
+ --- a/source/lexbor/css/syntax/state.c
+ +++ b/source/lexbor/css/syntax/state.c
+ @@ -149,15 +149,10 @@ lxb_css_syntax_state_valid_escape(const lxb_char_t *data,
+  lxb_inline bool
+  lxb_css_syntax_state_non_ascii(lxb_codepoint_t cp)
+  {
+ -    /*
+ -     * Actually here the comparison should be to U+D7FF.
+ -     * But we capture surrogate pairs, they will be further converted to 0xFFFD.
+ -     */
+ -
+      /* This code is generated by the file utils/lexbor/css/syntax/non_ascii.pl */
+
+      /* Begin */
+ -    if (cp <= 0x218F) {
+ +    if (cp <= 0x2040) {
+          if (cp <= 0x00F6) {
+              if (cp >= 0x00B7 && cp <= 0x00B7) {
+                  return true;
+ @@ -172,36 +167,46 @@ lxb_css_syntax_state_non_ascii(lxb_codepoint_t cp)
+              }
+          }
+          else if (cp >= 0x00F8) {
+ -            if (cp <= 0x037D) {
+ -                return true;
+ +            if (cp <= 0x1FFF) {
+ +                if (cp <= 0x037D) {
+ +                    return true;
+ +                }
+ +                else if (cp >= 0x037F) {
+ +                    return true;
+ +                }
+              }
+ -            else if (cp >= 0x037F) {
+ -                if (cp <= 0x1FFF) {
+ +            else if (cp >= 0x200C) {
+ +                if (cp <= 0x200D) {
+                      return true;
+                  }
+ -                else if (cp >= 0x2070) {
+ +                else if (cp >= 0x203F) {
+                      return true;
+                  }
+              }
+          }
+      }
+ -    else if (cp >= 0x2C00) {
+ -        if (cp <= 0xFDCF) {
+ -            if (cp <= 0x2FEF) {
+ +    else if (cp >= 0x2070) {
+ +        if (cp <= 0xD7FF) {
+ +            if (cp <= 0x218F) {
+                  return true;
+              }
+ -            else if (cp >= 0x3001) {
+ -                if (cp <= 0xDFFF) {
+ +            else if (cp >= 0x2C00) {
+ +                if (cp <= 0x2FEF) {
+                      return true;
+                  }
+ -                else if (cp >= 0xF900) {
+ +                else if (cp >= 0x3001) {
+                      return true;
+                  }
+              }
+          }
+ -        else if (cp >= 0xFDF0) {
+ +        else if (cp >= 0xF900) {
+              if (cp <= 0xFFFD) {
+ -                return true;
+ +                if (cp <= 0xFDCF) {
+ +                    return true;
+ +                }
+ +                else if (cp >= 0xFDF0) {
+ +                    return true;
+ +                }
+              }
+              else if (cp >= 0x10000) {
+                  if (cp <= 0x10FFFF) {
+ @@ -212,7 +217,7 @@ lxb_css_syntax_state_non_ascii(lxb_codepoint_t cp)
+      }
+      /* End */
+
+ -    return cp == 0x200C || cp == 0x200D || cp == 0x203F || cp == 0x2040;
+ +    return false;
+  }
+
+  lxb_inline bool