getgrav/grav · error · RuntimeException
Malformed URL: {url}
Error message
Malformed URL: {url} What it means
Error "Malformed URL: {url}" thrown in getgrav/grav.
Source
Thrown at system/src/Grav/Common/Uri.php:1350
/**
* Does this Uri use a standard port?
*
* @return bool
*/
protected function hasStandardPort()
{
return (!$this->port || $this->port === 80 || $this->port === 443);
}
/**
* @param string $url
*/
protected function createFromString($url)
{
// Set Uri parts.
$parts = parse_url($url);
if ($parts === false) {
throw new RuntimeException('Malformed URL: ' . $url);
}
$port = (int)($parts['port'] ?? 0);
$this->scheme = $parts['scheme'] ?? null;
$this->user = $parts['user'] ?? null;
$this->password = $parts['pass'] ?? null;
$this->host = $parts['host'] ?? null;
$this->port = $port ?: null;
$this->path = $parts['path'] ?? '';
$this->query = $parts['query'] ?? '';
$this->fragment = $parts['fragment'] ?? null;
// Validate the hostname
if ($this->host) {
$this->host = $this->validateHostname($this->host) ? $this->host : 'unknown';
}
// Filter userinfo, path, query string and fragment.
$this->user = $this->user !== null ? static::filterUserInfo($this->user) : null;View on GitHub (pinned to 6040efed04)
When it happens
Trigger: Thrown at system/src/Grav/Common/Uri.php:1350 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17).
Data as JSON: /api/errors/b8629c781c7b2914.
Report an issue: GitHub.