Skip to content

Commit 11c0600

Browse files
committedJan 4, 2025·
bug #6684 Deprecate the AdminContext:getReferrer() method (javiereguiluz)
This PR was merged into the 4.x branch. Discussion ---------- Deprecate the AdminContext:getReferrer() method Fixes #6115. This was deprecated in practice a long time ago, when we removed the `referrer` parameter from URLs in #6105. But, we didn't formally deprecate the associated method in `AdminContext:getReferrer()`. Let's do that now. Commits ------- 384741e Deprecate the AdminContext:getReferrer() method
2 parents faa7730 + 384741e commit 11c0600

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

‎UPGRADE.md

+18
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,24 @@ that page title:
117117
}
118118
}
119119

120+
EasyAdmin 4.8.11
121+
----------------
122+
123+
EasyAdmin URLs no longer include the `referrer` query parameter, and the
124+
`AdminContext:getReferrer()` method is deprecated.
125+
126+
This change is part of the long-term project to simplify URLs, with the goal of
127+
using pretty URLs in the future. If you still need to access the referrer, you
128+
can retrieve it from the HTTP headers provided by browsers:
129+
130+
```php
131+
// Before
132+
return $this->redirect($context->getReferrer());
133+
134+
// After
135+
return $this->redirect($context->getRequest()->headers->get('referer'));
136+
```
137+
120138
EasyAdmin 4.8.0
121139
---------------
122140

‎src/Context/AdminContext.php

+7
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public function getRequest(): Request
7070

7171
public function getReferrer(): ?string
7272
{
73+
trigger_deprecation(
74+
'easycorp/easyadmin-bundle',
75+
'4.8.11',
76+
'EasyAdmin URLs no longer include the referrer URL. If you still need it, you can get the referrer provided by browsers via $context->getRequest()->headers->get(\'referer\').',
77+
__METHOD__,
78+
);
79+
7380
$referrer = $this->request->query->get(EA::REFERRER);
7481

7582
return '' !== $referrer ? $referrer : null;

0 commit comments

Comments
 (0)
Please sign in to comment.