- Affected version
- 2.2.3
Calling
This is because
In the admin context,
getThreadFromUrl
from an admin app context with a non-friendly public thread URL will fail.This is because
getThreadFromUrl($url, $type)
calls getRoutePathFromUrl($url)
which calls getExtendedUrl($url)
. However getExtendedUrl
work with the current request object to determine the base URL, not the actual $type
argument.
PHP:
public function getThreadFromUrl($url, $type = null, &$error = null)
{
$routePath = $this->app()->request()->getRoutePathFromUrl($url);
...
public function getRoutePathFromUrl($url)
{
$url = $this->convertToAbsoluteUri($url);
$url = str_replace($this->getHostUrl(), '', $url);
$routePath = ltrim($this->getExtendedUrl($url), '/');
...
public function getExtendedUrl($requestUri = null)
{
$baseUrl = $this->getBaseUrl();
...
public function getBaseUrl()
{
$baseUrl = $this->getServer('SCRIPT_NAME', '');
$basePath = dirname($baseUrl);
if (strlen($basePath) <= 1)
{
// Looks to be at the root, so trust that.
return $baseUrl;
}
$requestUri = $this->getRequestUri();
...
In the admin context,
getBaseUrl
returns /admin.php
, which causes /index.php?threads/1/
to not be resolved to the expected ?threads/1/
fir the rest of the getThreadFromUrl
code.