default modifier

From: Date: Sun, 05 Feb 2006 06:15:53 +0000
Subject: default modifier
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2833@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, when using the default modifier (for example {$whatever|default:'foo'}) you will get a E_NOTICE (or was it E_USER_NOTICE? - i know this is suppressed by smartys error_reporting setting, but that doesn't work when using a custom error handler) because of the following code (this is from a compiled template): <?php echo ((is_array($_tmp=@$this->_tpl_vars['whatever'])) ? $this->_run_mod_handler('default', true, $_tmp, 'foo') : smarty_modifier_default($_tmp, 'foo')); ?> This is alright because this is how a modifier works. However to avoid a E_NOTICE why not just implement the default modifier just like {if isset($whatever)}$whatever{else}foo{/if} would work? Or maybe change the way modifiers are compiled by including an isset? Best Regards, Danilo Buerger PS: This is on PHP 5.1.2. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFD5ZgZtyx3EHt/UjARAl7NAJ44M7hFraBE5rBivAWk+R/+LVp5QwCfS+t8 2veHNmORiN+qzAeMX1Tx5z8= =Z69k -----END PGP SIGNATURE-----

« previous php.smarty.dev (#2833) next »