Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$block->toHtml() renders error message on error even if not in debug mode. #4448

Closed
texnixe opened this issue Jun 30, 2022 · 2 comments · Fixed by #4456
Closed

$block->toHtml() renders error message on error even if not in debug mode. #4448

texnixe opened this issue Jun 30, 2022 · 2 comments · Fixed by #4456
Assignees
Labels
type: bug 🐛 Is a bug; fixes a bug
Milestone

Comments

@texnixe
Copy link
Member

texnixe commented Jun 30, 2022

Description

This is the code in the html() method that causes this behavior.

   try {
            return (string)snippet('blocks/' . $this->type(), $this->controller(), true);
        } catch (Throwable $e) {
            return '<p>Block error: "' . $e->getMessage() . '" in block type: "' . $this->type() . '"</p>';
        }

Expected behavior
There should be a check if debug is on or off and only show the message in debug mode, otherwise an empty string.

Screenshots

To reproduce

  1. Disable debug mode
  2. Create block snippet with error
  3. see error message

Your setup

Kirby Version
Tested with 3.7.0.1

@texnixe texnixe added type: bug 🐛 Is a bug; fixes a bug labels Jun 30, 2022
@texnixe
Copy link
Member Author

texnixe commented Jun 30, 2022

We should probably also double-check if there are other places where the frontend might give information away in non-debug mode.

@texnixe texnixe self-assigned this Jun 30, 2022
@afbora afbora linked a pull request Jul 1, 2022 that will close this issue
5 tasks
@afbora afbora added this to the 3.7.1 milestone Jul 1, 2022
@lukasbestle
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Is a bug; fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants