Welcome Guest, Not a member yet? Register   Sign In
Template Parser: numeric type bug
#1

[eluser]champs[/eluser]
The following code in the Template Parser class will only substitute strings and arrays -- meaning it ignores numeric typed data.

An example:
Code:
// this line never highlights correctly

/* template snippet */
<Jpeg Quality="{quality}"></Jpeg>

/* controller snippet */
// as a number
$data = array('quality' => 80);
echo $this->parser->parse('view', $data, true);

// echoes '<Jpeg Quality="{quality}"></Jpeg>'

$data = array('quality' => '80');
echo $this->parser->parse('view', $data, true);

// output: '<Jpeg Quality="80"></Jpeg>'

The offending code is in Parser.php ~line 57:
Code:
if (is_string($val))
{
    $template = $this->_parse_single($key, $val, $template);
}
elseif (is_array($val))
{
    $template = $this->_parse_pair($key, $val, $template);
}

I would substitute the call to is_string() with is_scalar() -- and maybe filter/convert booleans.

This is being posted just as a reference for the bug tracker
#2

[eluser]Unknown[/eluser]
This BUG is NOT FIXED.

Sorry, i`m new on this forum and i started a new thread to say this.

http://ellislab.com/forums/viewthread/70564/




Theme © iAndrew 2016 - Forum software by © MyBB