filp/whoops · error · UnexpectedValueException

Whoops\Handler\PrettyPageHandler::getEditor should always re

Error message

Whoops\Handler\PrettyPageHandler::getEditor should always resolve to a string or a valid editor array; got something else instead.

What it means

Error "Whoops\Handler\PrettyPageHandler::getEditor should always resolve to a string or a valid editor array; got something else instead." thrown in filp/whoops.

Source

Thrown at src/Whoops/Handler/PrettyPageHandler.php:521

     * @param string $filePath
     * @param int    $line
     *
     * @throws InvalidArgumentException If editor resolver does not return a string
     *
     * @return string|bool
     */
    public function getEditorHref($filePath, $line)
    {
        $editor = $this->getEditor($filePath, $line);

        if (empty($editor)) {
            return false;
        }

        // Check that the editor is a string, and replace the
        // %line and %file placeholders:
        if (!isset($editor['url']) || !is_string($editor['url'])) {
            throw new UnexpectedValueException(
                __METHOD__ . " should always resolve to a string or a valid editor array; got something else instead."
            );
        }

        $editor['url'] = str_replace("%line", rawurlencode($line), $editor['url']);
        $editor['url'] = str_replace("%file", rawurlencode($filePath), $editor['url']);

        return $editor['url'];
    }

    /**
     * Determine if the editor link should act as an Ajax request.
     *
     * @param string $filePath
     * @param int    $line
     *
     * @throws UnexpectedValueException If editor resolver does not return a boolean
     *

View on GitHub (pinned to fa1bc9c95a)

When it happens

Trigger: Thrown at src/Whoops/Handler/PrettyPageHandler.php:521 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of filp/whoops@fa1bc9c95a (2026-08-21). Data as JSON: /api/errors/228e49a9d93c5883. Report an issue: GitHub.