Bug #6822

unhelpful error message if template cannot be read

Added by Florian Staudacher over 5 years ago. Updated about 4 years ago.

Status:Closed Start date:2010-03-14
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:Core
Target version:-
Has patch: Affected Flow version:

Description

I reported this bug there: http://bugs.typo3.org/view.php?id=13810 earlier and was told to put it here, so here it comes:

in typo3/sysext/fluid/Classes/View/TemplateView.php on line 358 the method parseTemplate() should return a helpful error message in case the file cannot be read.
I had forgotten to give the server read access to my template file and the only thing i got over and over was

Tx_Fluid_Core_Parser_Exception
Parse requires a template string as argument, boolean given.

from the typo3/sysext/fluid/Classes/Core/Parser/TemplateParser.php on line 271.
I mean if you know that file_get_contents returns false if there is an error, it's simple to look for the error, but even that involves looking at the code to see how the file gets read.

Please replace with/add a more suiting error message

History

#1 Updated by Sebastian Kurfuerst over 5 years ago

  • Status changed from New to Needs Feedback

Hey,

thanks for your bug report. I think this has been solved meanwhile in the newest Fluid Trunk. At least in https://svn.typo3.org/TYPO3v4/CoreProjects/MVC/fluid/trunk/Classes/View/TemplateView.php the method parseTemplate now has a proper error message:

    protected function parseTemplate($templatePathAndFilename) {
        $templateSource = file_get_contents($templatePathAndFilename);
        if ($templateSource === FALSE) {
            throw new Tx_Fluid_View_Exception_InvalidTemplateResourceException('"' . $templatePathAndFilename . '" is not a valid template resource URI.', 1257246929);
        }
        return $this->templateParser->parse($templateSource);
    }

Do you agree on this?

Greets,
Sebastian

#2 Updated by Florian Staudacher over 5 years ago

I guess if the error message gets documented in some way (online or what not), there would be a list of possible reasons and then file permissions should be added to that list. But since documentation is relatively rare at the moment, this message is definately better than before.

#3 Updated by Sebastian Kurfuerst about 4 years ago

  • Status changed from Needs Feedback to Closed

thanks for the feedback!

Also available in: Atom PDF