Re: [SMARTY] The dreaded 'Fatal error: Call to undefined function: ()' error
| From: | Monte Ohrt | Date: | Wed, 31 Jul 2002 13:35:41 +0000 |
| Subject: | Re: [SMARTY] The dreaded 'Fatal error: Call to undefined function: ()' error | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5535@lists.php.net to get a copy of this message | ||
We could stop execution upon a plugin error. I'm wondering if this should be done on any plugin error, maybe other errors, or what other consequences there would be.
Andrei, your thoughts?
Monte
Ferdinand Beyer wrote:
On 31 Jul 2002 at 0:46, Tim Fountain wrote:-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.Smarty always triggers PHP warnings with trigger_error() if it cannot load a plugin. So your requested feature is already implemented -- I don't know why these warning do not show up on your system. Perhaps it is inside a HTML tag so that it is not displayed...? Quoting Monte: ================================================== You should always get other warnings before your "undefined function" errors, something like this: PHP Warning: Smarty plugin error: [in index.tpl line 7]: modifier 'upper' is not implemented in /path/to/Smarty.class.php on line 1958 <br /> PHP Warning: Smarty plugin error: [in index.tpl line 13]: unknown tag - 'html_select_date' in /path/to/Smarty.class.php on line 1958 <br /> ==================================================But you're right: Smarty should suppress a undefined-function fatal error - ie. by checking if a plugin is loaded before calling it in the compiled template.That's not exactly what I was saying - I was saying Smarty should display an error if it fails to load a plugin, to prevent the cryptic error that may occur later when an undefined plugin is called.On the other hand, your templates may not use the plugin at all so not being able to load it wouldn't be a problem. It's a tricky one.Smarty is so 'smart' to load plugins only when they are needed in a template. Another Monte's quote: ================================================== If those functions don't get defined (by loading the plugin), then you will get undefined function errors. I don't think it would be correct to supress them, they are errors that happen. In this guys case, he wouldn't have seen any errors, making things even more difficult to debug. ================================================== I don't agree with Monte here: Smarty knows that an undefined- function error will appear if it cannot load a plugin - since it will try to call that function later on. That's why Smarty should trigger a *fatal* error if it cannot load a plugin to prevent a nonsence-fatal like "undefined function '()' in ...." that is confusing and very difficult to debug. If a user sees the error Fatal error: Smarty: failed loading plugin 'xxyyzz' in template .... he immediately knows what's wrong.