Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

$error_reporting is not processed in 3.0-Release

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
artvolk
Smarty Regular


Joined: 09 Dec 2009
Posts: 45

PostPosted: Fri Nov 12, 2010 10:18 am    Post subject: $error_reporting is not processed in 3.0-Release Reply with quote

Hallo!

I used to use latest /trunk of Smarty 3.0 and I use this:

Code:

  // When set, smarty does uses this value as error_reporting-level.
  public $error_reporting = null;


It seems that in release this check is missing:

Code:

        if (isset($this->error_reporting)) {
           $_smarty_old_error_level = error_reporting($this->error_reporting);
       }


So this option has no effect.

Am I the first one with bug report for release? Smile
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Nov 12, 2010 11:55 am    Post subject: Reply with quote

Hi

This is not a bug. The error_reporting property has been dropped in Smarty3. It does not really make sense any longer to you different reporting levels for Smarty as in your application.

If you rellay need some thing different you can set the error reporting level in your application before calling Smarty.
Back to top
View user's profile Send private message
matsberg
Smarty n00b


Joined: 12 Nov 2010
Posts: 4
Location: Sweden

PostPosted: Fri Nov 12, 2010 12:01 pm    Post subject: Reply with quote

U.Tews wrote:
Hi

This is not a bug. The error_reporting property has been dropped in Smarty3. It does not really make sense any longer to you different reporting levels for Smarty as in your application.

If you rellay need some thing different you can set the error reporting level in your application before calling Smarty.


I think it was better before, i do want notices enabled for the rest of my site but not for my templates as there is a lot of undefineds in the templates as it is for now.

If i disable error reporting before calling smarty i will not get reporting in any subsequent code.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Nov 12, 2010 12:43 pm    Post subject: Reply with quote

I agree with U. Tews: you should handle error reporting on your own.

If you have "subsequent code" (In my applications something like $smarty->display() is almost always the last line of the outermost called php-file)
you can easily restore error_reporting after calling Smarty::display().

(U Tews.: congrats to the 3.0-release, btw Smile )
Back to top
View user's profile Send private message Send e-mail Visit poster's website
matsberg
Smarty n00b


Joined: 12 Nov 2010
Posts: 4
Location: Sweden

PostPosted: Fri Nov 12, 2010 1:16 pm    Post subject: Reply with quote

messju wrote:

If you have "subsequent code" (In my applications something like $smarty->display() is almost always the last line of the outermost called php-file)
you can easily restore error_reporting after calling Smarty::display().


Since i use quite a number of templates on every page its not an option.
I also use smarty to generate XML and other stuff, so i really need the notices where they are needed (outside smarty).

In V2 it worked just fine.
In V3 dev it worked fine. Then it suddenly stopped working and we were given the error_reporting variabe to set the flags, with was fine.

Now the only option is to disable error_reporting everytime i access the smarty object, unless i want to tamper with hundreds of smarty calls in my code.
Back to top
View user's profile Send private message
artvolk
Smarty Regular


Joined: 09 Dec 2009
Posts: 45

PostPosted: Fri Nov 12, 2010 2:28 pm    Post subject: Reply with quote

Here are some thoughts:

- My code is developed with all possible error reporting, but templates are ported from 2.0 (where checking for variable in the way {if $variable}) was really common).

- There are situations where Smarty is used more that once during one page hit. For example we use Smarty for multiple e-mail templates before rendering the actual page using Smarty.

- It's breaking change at least for those who used /trunk and betas is it possible to mention it in README?

- The variable $error_reporting left in source, but is not used. Is this intentional?

About this issue -- the only way I see for myself is to apply local patch, but this is what most of us like to avoid.

Anyway I'm happy about release! At least I can remove svn:externals pointing to smarty repository from my projects Smile
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Nov 12, 2010 2:39 pm    Post subject: Reply with quote

The idea behind removing error_reporting: all E_NOTICE situations in Smarty templates have been addressed. When you set an error_reporting level in templates, this also affects all plugins/filters/etc. So it should be possible to use the PHP-level error_reporting for templates now, and clean up any E_NOTICE situations in your own code.

However, it appears there are situations where users still want a separate error_reporting level for templates. We will restore error_reporting in the engine, but default will be the PHP error_reporting level. You will need to change this yourself.
Back to top
View user's profile Send private message Visit poster's website
artvolk
Smarty Regular


Joined: 09 Dec 2009
Posts: 45

PostPosted: Fri Nov 12, 2010 2:40 pm    Post subject: Reply with quote

Is this the same behaviour as in /trunk before release?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Nov 12, 2010 4:01 pm    Post subject: Reply with quote

artvolk wrote:
Is this the same behaviour as in /trunk before release?


yes, same as RC4
Back to top
View user's profile Send private message Visit poster's website
artvolk
Smarty Regular


Joined: 09 Dec 2009
Posts: 45

PostPosted: Fri Nov 12, 2010 4:01 pm    Post subject: Reply with quote

Thanks, this change will be in release available for download or in SVN?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Nov 12, 2010 4:05 pm    Post subject: Reply with quote

already released 3.0.1.
Back to top
View user's profile Send private message Visit poster's website
matsberg
Smarty n00b


Joined: 12 Nov 2010
Posts: 4
Location: Sweden

PostPosted: Fri Nov 12, 2010 4:06 pm    Post subject: Reply with quote

artvolk wrote:
Thanks, this change will be in release available for download or in SVN?


It seems to be fixed in SVN already.

Thank you!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP