Skip to content

Commit 13af9e5

Browse files
authored
Merge pull request #5345 from kenjis/fix-request-uri
docs: don't use `IncomingRequest::$uri`
2 parents c3e43e9 + 05ce6cb commit 13af9e5

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

system/HTTP/IncomingRequest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class IncomingRequest extends Request
6464
* AFTER the script name. So, if hosted in a sub-folder this will
6565
* appear different than actual URL. If you need that use getPath().
6666
*
67+
* @TODO should be protected. Use getUri() instead.
68+
*
6769
* @var URI
6870
*/
6971
public $uri;

user_guide_src/source/concepts/http.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ is an object-oriented representation of the HTTP request. It provides everything
7575
$request = service('request');
7676

7777
// the URI being requested (i.e., /about)
78-
$request->uri->getPath();
78+
$request->getUri()->getPath();
7979

8080
// Retrieve $_GET and $_POST variables
8181
$request->getGet('foo');

user_guide_src/source/incoming/incomingrequest.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,13 @@ The Request URL
249249
---------------
250250

251251
You can retrieve a :doc:`URI </libraries/uri>` object that represents the current URI for this request through the
252-
``$request->uri`` property. You can cast this object as a string to get a full URL for the current request::
252+
``$request->getUri()`` method. You can cast this object as a string to get a full URL for the current request::
253253

254-
$uri = (string)$request->uri;
254+
$uri = (string) $request->getUri();
255255

256256
The object gives you full abilities to grab any part of the request on it's own::
257257

258-
$uri = $request->uri;
258+
$uri = $request->getUri();
259259

260260
echo $uri->getScheme(); // http
261261
echo $uri->getAuthority(); // snoopy:[email protected]:88

0 commit comments

Comments
 (0)