Skip to content

Commit 492b9a6

Browse files
committed
Document URL parsing changes in 6.0
Refs cakephp/cakephp#19664.
1 parent 993b941 commit 492b9a6

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎docs/en/appendices/6-0-migration-guide.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ Some properties have also been renamed to better reflect their purpose. These ar
131131
- The methods `_getCookies()`, `_getJson()`, `_getXml()`, `_getHeaders()`
132132
and `_getBody()` have been removed. Use/Overwrite their non-prefixed public alternative instead.
133133

134+
- URL parsing now uses PHP 8.5's `Uri\WhatWg\Url` and `Uri\Rfc3986\Uri`
135+
parsers. Review malformed or relative URL inputs and exception handling. In
136+
particular, `Client::createFromUrl()` can now throw
137+
`Uri\WhatWg\InvalidUrlException` for inputs previously rejected with
138+
`InvalidArgumentException`. See
139+
[Creating Scoped Clients](../core-libraries/httpclient#http_client_scoped_client).
140+
134141
### ORM
135142

136143
- The `_accessible` property inside Entities has been renamed to `patchable`

‎docs/en/core-libraries/httpclient.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,15 @@ If your scoped client only needs information from the URL you can use
308308
$http = Client::createFromUrl('https://api.example.com/v1/test');
309309
```
310310

311-
The above would create a client instance with the `protocol`, `host`, and
312-
`basePath` options set.
311+
The above creates a client with `scheme`, `host`, `port` and `basePath`
312+
options derived from the URL. Query strings and fragments are not used to
313+
configure the scoped client.
314+
315+
`createFromUrl()` uses PHP's WHATWG URL parser. Supply an absolute URL with
316+
a scheme and host. Malformed or relative URLs can throw
317+
`Uri\WhatWg\InvalidUrlException`; a parsed URL with no host raises
318+
`InvalidArgumentException`. The parser normalizes URLs, including removing
319+
default ports such as `:80` from HTTP URLs.
313320

314321
The following information can be used when creating a scoped client:
315322

0 commit comments

Comments
 (0)