Commit 8e6d3759669 for php.net

commit 8e6d37596693738a1bf22ae1739fad17ce9de3b9
Author: Tim Düsterhus <tim@bastelstu.be>
Date:   Mon Nov 17 19:28:51 2025 +0100

    lexbor: Cherry pick "URL: the cloning function does not copy the type for IPv4 and IPv6."

    see lexbor/lexbor@dcfcd645c672816ca8dc2335dfd1402b0a4aa40c

    Fixes php/php-src#20501

diff --git a/NEWS b/NEWS
index 38d8d734a04..ef086acf89f 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,10 @@ PHP                                                                        NEWS
   . Fixed bug GH-20483 (ASAN stack overflow with fiber.stack_size INI
     small value). (David Carlier)

+- Lexbor:
+  . Fixed bug GH-20501 (\Uri\WhatWg\Url lose host after calling
+    withPath() or withQuery()). (lexborisov)
+
 - Opcache:
   . Fixed bug GH-20329 (opcache.file_cache broken with full interned string
     buffer). (Arnaud)
diff --git a/ext/lexbor/lexbor/url/url.c b/ext/lexbor/lexbor/url/url.c
index 7bfc007e622..99ba809b05f 100644
--- a/ext/lexbor/lexbor/url/url.c
+++ b/ext/lexbor/lexbor/url/url.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2023-2024 Alexander Borisov
+ * Copyright (C) 2023-2025 Alexander Borisov
  *
  * Author: Alexander Borisov <borisov@lexbor.com>
  */
@@ -1106,9 +1106,9 @@ lxb_url_host_copy(const lxb_url_host_t *src, lxb_url_host_t *dst,
         }
     }

-    if (src->type <= LXB_URL_HOST_TYPE_OPAQUE) {
-        dst->type = src->type;
+    dst->type = src->type;

+    if (src->type <= LXB_URL_HOST_TYPE_OPAQUE) {
         if (src->type == LXB_URL_HOST_TYPE__UNDEF) {
             return LXB_STATUS_OK;
         }