Skip to content

Regression: parse_url() IPv6 bracketed host — host truncated at first colon, port dropped (ext/standard/url.c) #13739

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

parse_url() mishandles IPv6 literal authorities in bracket notation. The VM splits host:port on the first colon inside the authority, so bracketed addresses are truncated and ports are lost.

URL Zend host VM host today
http://[::1]/ [::1] [
http://[::1]:8080/path [::1] + port=8080 [ (no port)
http://[2001:db8::1]/ [2001:db8::1] [2001
ftp://user:pass@[::1]:21/ [::1] + port=21 [

php-src treats [...] as an opaque host token and only parses :port after the closing ].

php-src reference

Repro (verified 2026-06-29)

php test/repro/maintainer_gap_parse_url_ipv6_host.php
php bin/vm.php test/repro/maintainer_gap_parse_url_ipv6_host.php

Zend prints four ok:… lines; VM prints fail:… for each IPv6 case.

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/VmString.php (parseUrlAuthority()), ext/standard/parse_url.php
JIT/AOT ext/standard/JitParseUrl.php, ext/standard/ParseUrlJitHelper.php
Tests test/compliance/cases/stdlib/parse_url_ipv6*.phpt

Done when (php-src-strict)

  • Repro prints only ok:… lines on VM
  • PHP_URL_HOST / PHP_URL_PORT component queries agree for IPv6 URLs
  • Scheme-relative //[::1]:8080/… still correct
  • Targeted compliance test green

Verification

php test/repro/maintainer_gap_parse_url_ipv6_host.php
php bin/vm.php test/repro/maintainer_gap_parse_url_ipv6_host.php

Links

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 29, 2026
  2. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #13740, #13739)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Merged in PR #13745. VM + JIT compliance + AOT lint green for IPv6 bracketed host repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions