181 Commits
Author SHA1 Message Date
Ilija Tovilo d6373dfe15 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:33:23 +02:00
Ilija Tovilo c7273b9ba8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:30:04 +02:00
NickSdot 95ed6c1427 ext/uri: Fixes url delimiters (#23815)
Fix Uri\WhatWg\UrlBuilder's query and fragment handling to be in line with the behavior of the WHATWG URL setter algorithms: Empty strings now remove the corresponding component instead of creating an empty one, both with and without a base URL. An empty component can still be created by passing "?" or "#".
2026-10-20 14:09:39 +02:00
NickSdot ccd446f229 ext/uri: Refactors builder error handling (#23834) 2026-10-20 12:06:08 +02:00
NickSdotandTim Düsterhus c01c9d009c ext/uri: Fixes inconsistent validation ordering (#23823)
Co-authored-by: Tim Düsterhus <209270+TimWolla@users.noreply.github.com>
2026-10-07 14:51:24 +02:00
Máté Kocsis 7d1d66246e ext/uri: Address UrlBuilder todo comments
After https://github.com/lexbor/lexbor/pull/415 was merged to Lexbor and the change was applied to ext/lexbor via https://github.com/php/php-src/pull/23660, the temporary functions can be replaced with their counterpart in Lexbor.
2026-10-07 12:55:35 +02:00
Alexandre Daubois 12b8c58be4 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  lexbor: Merge upstream WHATWG URL and IDNA fixes
2026-10-06 09:10:40 +02:00
Alexandre Daubois beee5444d0 lexbor: Merge upstream WHATWG URL and IDNA fixes
lexbor/lexbor@859f100
lexbor/lexbor@a36e09a
lexbor/lexbor@b0f7412
lexbor/lexbor@1b215a8
lexbor/lexbor@385afff
lexbor/lexbor@e6c068f
lexbor/lexbor@327a8b6
lexbor/lexbor@917742f
lexbor/lexbor@e89c258

Only the source/lexbor/url part of lexbor/lexbor@327a8b6 and
lexbor/lexbor@e89c258 is carried: the first squash also contains unrelated
HTML tree construction changes, and the second documents a percent-encoder
API that this branch does not bundle.
2026-10-06 08:59:31 +02:00
Daniel Scherzer f2c9e03e4a [%pS migration] Use %pS in ext/uri (#23172) 2026-10-04 19:33:11 -07:00
NickSdot 86444fc994 ext/uri: Allow empty credentials in the WHATWG URL Builder (#23816)
Uri\WhatWg\UrlBuilder previously treated empty usernames and passwords as credentials (https://url.spec.whatwg.org/#include-credentials) during validation, rejecting them for URLs that cannot contain credentials (https://url.spec.whatwg.org/#cannot-have-a-username-password-port) and for references without an authority.

These checks now reject only non-empty values, since empty strings do not introduce credentials.
2026-10-01 14:36:44 +02:00
NickSdot 9eeb1e8f7e ext/uri: fixed url path resolution (#23817) 2026-09-27 21:12:06 +02:00
Tim Düsterhus 4ff538c4ad uri: Fix casing of UriHostType and UrlHostType enum cases (#23851)
According to naming policy and the RFC, these should be `IpV`, not `IPv`.
2026-09-22 17:11:45 +02:00
Máté Kocsis c2f686a21d Implement "Followup improvements for ext/uri" RFC - URL building with base URL (#23526)
Add support for passing a non-null $baseUrl parameter for Uri\WhatWg\UrlBuilder::build().

RFC: https://wiki.php.net/rfc/uri_followup#uri_building
2026-09-20 12:31:00 +02:00
Máté Kocsis c67088d46e ext/uri: Fix the behavior for $softErrors (#23740)
Uri\WhatWg\Url::__construct() and Uri\WhatWg\UrlBuilder::build() now set $softErrors to an empty array when URL processing throws an exception, instead of preserving its value.
2026-09-20 08:09:09 +02:00
Máté Kocsis 703b5bb37a ext/uri: Fix throwing Uri\UriError
Since it doesn't have an $errors property
2026-09-17 22:54:02 +02:00
Máté Kocsis eb34f8920d ext/uri: Build hostless URLs with the correct path type
Preserve absent hosts for non-special URLs and initialize opaque paths directly. Add validation to reject path delimiters.

Closes GH-23636
2026-09-16 22:39:08 +02:00
Máté Kocsis 2b9b40779a ext/uri: Minor fixes for Uri\WhatWg\UrlBuilder
- Memory allocation errors would trigger an Error
- Various style fixes
- Test improvements
2026-09-16 21:14:33 +02:00
Máté Kocsis 100e8f353e ext/uri: Preserve empty query and fragment in URL builders
Keep empty components distinct from null so serialization retains the trailing question mark or hashmark.
2026-09-14 21:18:35 +02:00
Máté Kocsis 3bec7e4b66 ext/uri: Validate credentials against normalized builder hosts
Reject credentials and ports when a host becomes empty after normalization instead of silently discarding them. Perform validation once, after setting the host.
2026-09-14 21:18:25 +02:00
Máté Kocsis a7a2303f95 ext/uri: Return builder soft errors consistently
Rename the output argument to softErrors and clear it on error-free success. Preserve it on failure while including earlier soft errors in the exception. This makes the behavior consistent with parsing in the constructor.
2026-09-14 21:17:40 +02:00
Máté Kocsis 1c2ae570dc ext/uri: Initialize builder validation exception errors
Populate validation error details when a code is available, and initialize an empty errors array for other builder failures.
2026-09-14 21:17:23 +02:00
Máté Kocsis a357c011ce ext/uri: Reject URL delimiters in builder hosts
Reject literal path, query and fragment delimiters before the hostname setter can silently discard the rest of the input.
2026-09-14 21:17:13 +02:00
Máté Kocsis fa1faaaac7 ext/uri: Make internal function naming consistent
Use component-first names for validation and percent-encoding helpers, matching the existing component read/write functions.
2026-09-07 20:56:42 +02:00
Dmytro Kulyk 67135cb97b gen_stub: Conditionally include zend_attributes.h to arginfo based on usage (#21570)
Headers required by the generated code (zend_attributes.h, zend_constants.h, zend_enum.h) are collected during generation and emitted as includes at the top of the arginfo file, with the same preprocessor conditions and PHP version guards as the code that needs them.

Removes the manual zend_attributes.h and zend_enum.h includes from sources that only needed them for the arginfo file they include.
2026-09-06 21:25:20 +02:00
NickSdot fd81673179 ext/uri: Consistency follow up to #23286 (#23551) 2026-09-04 14:41:38 +02:00
NickSdot c0352c2c0e ext/uri: Reorganises legacy tests (#23286) 2026-09-04 11:43:53 +02:00
Máté Kocsis 1273587b05 Implement "Followup improvements for ext/uri" RFC - WHATWG URL percent-encoding (#22820)
RFC: https://wiki.php.net/rfc/uri_followup#percent-encoding_support
2026-08-30 14:25:46 +02:00
Máté Kocsis bce6e73122 Implement "Followup improvements for ext/uri" RFC - WHATWG URL building (#22268)
RFC: https://wiki.php.net/rfc/uri_followup#uri_building

For now, supplying a (non-null) base URL to Uri\WhatWg\UrlBuilder::build() is not supported due to implementation complexity. This is going to be resolved as a followup.
2026-08-19 16:28:53 +02:00
NickSdot db9d9ccac3 ext/uri: Remove dead Uri\WhatWg\Url::getFragment() method implementation (#23303)
https://github.com/php/php-src/pull/18836/changes#diff-36685c80eb4c9b461c87f9f56845f1ad5f166f7e26d4e783b0511a1c670d8172R177 registered Uri\WhatWg\Url::getFragment() as an "implementation-alias", then https://github.com/php/php-src/pull/19636/changes#diff-80838f0d9bf6078a847dbafc2fff787d67013a7f19461cb6508246b5413fb4dfR900 added other aliases but also added the `getFragment()` method implementation back without removing its alias, which left it unused. So I am once again removing it here.
2026-08-16 22:32:45 +02:00
NickSdot d7a5e2f238 ext/uri: applied fixers to improve test robustness (#23271) 2026-08-15 14:32:41 +02:00
Máté Kocsis e63e2b7cc8 Fix typed reference property writes during Uri\Rfc3986\UriBuilder::reset() (#23144)
Originally found in https://github.com/php/php-src/pull/22268#discussion_r3705136377
2026-08-10 08:40:30 +02:00
Máté Kocsis e3de8edbae ext/uri: Add @strict-properties to the newly introduced UriBuilder class 2026-07-17 23:16:24 +02:00
Tim Düsterhus b84bd9ef3c Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/uri: Fix GH-22628 Percent-encoding of caret in WHATWG URL paths is not performed (#22700)
2026-07-12 20:53:05 +02:00
Máté Kocsis c025bc47db ext/uri: Fix GH-22628 Percent-encoding of caret in WHATWG URL paths is not performed (#22700)
The caret (^) is part of the path percent-encode set:

"The path percent-encode set is a percent-encode set consisting of the query percent-encode set and U+003F (?), U+005E (^), U+0060 (`), U+007B ({), and U+007D (})."

Until now, this character wasn't percent-encoded in the path likely due to a copy-paste error. This mistake is fixed by adding LXB_URL_MAP_PATH to the lxb_url_map entry for the caret.
2026-07-12 20:50:11 +02:00
Tim Düsterhus 1bf4be92dd Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/uri: Fix GH-22629 WHATWG validation error incorrect with empty host and non-empty userinfo (#22699)
2026-07-12 19:56:46 +02:00
Máté Kocsis 2014eb2cca ext/uri: Fix GH-22629 WHATWG validation error incorrect with empty host and non-empty userinfo (#22699)
The returned error code (LXB_URL_ERROR_TYPE_INVALID_CREDENTIALS) apparently contradicts the specification:

"If atSignSeen is true and buffer is the empty string, host-missing validation error, return failure."
2026-07-12 19:54:52 +02:00
Máté Kocsis 3704518154 ext/uri: Increase minimum uriparser version dependency (#22575)
uriparser 1.0.3 has to be released containing some missing symbols in order to be able to build PHP with the "--with-external-uriparser" option.

Closes https://github.com/php/php-src/issues/22553
2026-07-06 21:26:28 +02:00
Máté KocsisandTim Düsterhus 4999bcb29c Fix Ipv6 and ipvfuture address validation to use PHP's built-in memory manager (#22571)
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2026-07-03 14:34:11 +02:00
Máté Kocsis 4c20b1a8c2 Merge branch 'PHP-8.5'
* PHP-8.5:
  Apply lexbor fix for empty hosts (#22485)
2026-06-27 23:13:15 +02:00
Máté Kocsis 589b96c14b Apply lexbor fix for empty hosts (#22485)
Fixed behavior of Uri\WhatWg\Url wither methods with regards to empty opaque hosts (e.g. "scheme://") by applying the https://github.com/lexbor/lexbor/commit/cf07699ca0f5fa4e1f7fd05c2135fd38e6d196c2 upstream fix for lexbor.
2026-06-27 23:11:59 +02:00
henderkes 915318ed9c make all static extensions use TSRMG_STATIC
Closes GH-22277
2026-06-26 14:18:52 +02:00
Máté Kocsis 6d98178ca3 Improve Uri\Rfc3986\Builder tests
Addressing a few late review comments
2026-06-25 21:57:38 +02:00
Máté Kocsis 3f285f41fc Implement "Followup improvements for ext/uri" RFC - RFC 3986 URI building (#22173)
RFC: https://wiki.php.net/rfc/uri_followup#uri_building
2026-06-24 11:04:22 +02:00
Nora Dossche 60aab0fb13 Implement zend_enum_get_case_by_id() (#22402)
Avoid hash-based lookup if we already know the offset in the table
anyway.
2026-06-24 10:52:16 +02:00
Máté Kocsis 3642a7acbe Add a few missing modifiers for ext/uri functions
- static modifier is added for php_uri_parser_rfc3986_parse()
- const modifier is added for component read and write handler parameters
2026-06-14 14:13:36 +02:00
Máté Kocsis f26aae199f Microoptimize zval_long_or_null_to_lexbor_str
Based on Nora's suggestion of not using an unnecesary allocation.
2026-06-14 14:13:36 +02:00
Máté Kocsis a15155100d Constify the value param of the ext/uri write handlers (#22274)
The value parameter of the php_uri_property_handler_write callback is now const zval * instead of zval *, reflecting that write handlers must not modify the input zval.
2026-06-13 23:11:23 +02:00
Máté Kocsis b50b30c15e standard: Fail unserialization when the C format is used for classes that are not Serializable (#22058)
Fixes https://github.com/php/php-src/issues/22046
2026-06-12 22:03:27 +02:00
Máté Kocsis 78952c7821 Merge branch 'PHP-8.5'
* PHP-8.5:
  Clean Lexbor logs before each Uri\WhatWg\Url wither call (#22276)
2026-06-11 21:24:27 +02:00
Máté Kocsis c9cb1f9bec Clean Lexbor logs before each Uri\WhatWg\Url wither call (#22276)
Clean Lexbor error logs before each Uri\WhatWg\Url wither call so that errors from previous wither calls are not returned the next time a UrlValidationError is thrown.
2026-06-11 21:24:00 +02:00