Skip to content

Commit 3b15f6f

Browse files
authored
Merge pull request #8373 from cakephp/docs/6x-url-parsing-migration
Document URL parsing changes in 6.0
2 parents d9ccdb5 + 492b9a6 commit 3b15f6f

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
@@ -135,6 +135,13 @@ Some properties have also been renamed to better reflect their purpose. These ar
135135
- The methods `_getCookies()`, `_getJson()`, `_getXml()`, `_getHeaders()`
136136
and `_getBody()` have been removed. Use/Overwrite their non-prefixed public alternative instead.
137137

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

140147
- 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)