html_options function - htmlentities needed?

From: Date: Mon, 23 Sep 2002 09:01:49 +0000
Subject: html_options function - htmlentities needed?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6008@lists.php.net to get a copy of this message
Simple question: Shouldn't the html_options Smarty function apply htmlentities to the values it displays? The only reason I ask is because I can't decide whether it should be the responsibility of the coder to make sure that this is already done to data passed to Smary (although I'm pretty sure that Smarty is the best place for it). Modified version attached. Example: $smarty->assign('options', array('test' => '<This is a test>')); ... <SELECT> {html_options options=$options} </SELECT> renders as: <SELECT> <option value="test"><This is a test></option> </SELECT> Fix (not thoroughly tested!!): $ diff -w function.html_options.php.old function.html_options.php 27c27 < $html_result .= ">$value</option>\n"; --- > $html_result .= > ">".htmlentities($value)."</option>\n"; 43c43 < $html_result .= ">".$output[$i]."</option>\n"; --- > $html_result .= > ">".htmlentities($output[$i])."</option>\n"; Mark Rogers, Quarella Ltd

« previous php.smarty.general (#6008) next »