Merge branch '3.3.x'

This commit is contained in:
Marc Alexander 2024-10-17 20:38:58 +00:00
commit c1c5f6656f
2 changed files with 5 additions and 5 deletions

View file

@ -220,13 +220,13 @@ class path_helper
* *
* The referer must be specified as a parameter in the query. * The referer must be specified as a parameter in the query.
*/ */
if ($this->request->is_ajax() && $this->symfony_request->get('_referer')) if ($this->request->is_ajax() && $this->request->header('Referer'))
{ {
// We need to escape $absolute_board_url because it can be partially concatenated to the result. // We need to escape $absolute_board_url because it can be partially concatenated to the result.
$absolute_board_url = $this->request->escape($this->symfony_request->getSchemeAndHttpHost() . $this->symfony_request->getBasePath(), true); $absolute_board_url = $this->request->escape($this->symfony_request->getSchemeAndHttpHost() . $this->symfony_request->getBasePath(), true);
$referer_web_root_path = $this->get_web_root_path_from_ajax_referer( $referer_web_root_path = $this->get_web_root_path_from_ajax_referer(
$this->symfony_request->get('_referer'), $this->request->header('Referer'),
$absolute_board_url $absolute_board_url
); );
return $this->web_root_path = $referer_web_root_path; return $this->web_root_path = $referer_web_root_path;

View file

@ -464,9 +464,6 @@ class phpbb_path_helper_test extends phpbb_test_case
->setConstructorArgs([new phpbb_mock_request()]) ->setConstructorArgs([new phpbb_mock_request()])
->setMethods(['get', 'getSchemeAndHttpHost', 'getBasePath', 'getPathInfo']) ->setMethods(['get', 'getSchemeAndHttpHost', 'getBasePath', 'getPathInfo'])
->getMock(); ->getMock();
$symfony_request->method('get')
->with('_referer')
->willReturn('http://www.phpbb.com/community/route1/route2/');
$symfony_request->method('getSchemeAndHttpHost') $symfony_request->method('getSchemeAndHttpHost')
->willReturn('http://www.phpbb.com'); ->willReturn('http://www.phpbb.com');
$symfony_request->method('getBasePath') $symfony_request->method('getBasePath')
@ -480,6 +477,9 @@ class phpbb_path_helper_test extends phpbb_test_case
->willReturn(true); ->willReturn(true);
$request->method('escape') $request->method('escape')
->willReturnArgument(0); ->willReturnArgument(0);
$request->method('header')
->with('Referer')
->willReturn('http://www.phpbb.com/community/route1/route2/');
$path_helper = new \phpbb\path_helper( $path_helper = new \phpbb\path_helper(
$symfony_request, $symfony_request,