I’m really struggling with what I can only put down to being an EE or PHP error. I have the below code which is thowing an error when ran. It doesn’t matter if its in a snippet or simply in its own template with no other code.
<div class="langselect">
<ul class="no-js">
<li>
<a href="#" title="{gv_click_to_select_language_{language}}" class="clicker">{gv_theme_url}imgs/flag_{language}.png</a>
<ul>
<li><a href="http://www.site.com/{if">{gv_theme_url}imgs/flag_en.png EN</a></li>
<li><a href="http://fr.site.com/{if">{gv_theme_url}imgs/flag_fr.png FR</a></li>
<li><a href="http://de.site.com/{if">{gv_theme_url}imgs/flag_de.png DE</a></li>
<li><a href="http://sp.site.com/{if">{gv_theme_url}imgs/flag_sp.png SP</a></li>
<li><a href="http://it.site.com/{if">{gv_theme_url}imgs/flag_it.png IT</a></li>
<li><a href="http://po.site.com/{if">{gv_theme_url}imgs/flag_br.png PO</a></li>
</ul>
</li>
</ul>
</div>When the page is loaded I get the following error:
Parse error: syntax error, unexpected T_ENDIF in /home/blah/public_html/blah/adminfolder/expressionengine/libraries/Functions.php(684) : eval()'d code on line 9However, when I take out any two lines or reduce the amount of if statements it works fine. It can be any if statements just needs to be a set quantity to work.
So to debug I have edited the Functions.php file evaluate function to the following:
echo $str;
return eval('?'.'>'.$str.'<?php ');
$x = eval('?'.'>'.$str.'<?php ');
if($x === false) {
$timestamp = date("m-d-Y H:i:s");
$msg = "Timestamp:".$timestamp."\n".$str;
$fp = fopen("/tmp/evaluate_function.txt", 'a');
fwrite($fp, $msg . "\n");
fclose($fp);
exit;
} else {
return $x;
}Nothing gets added to /tmp/evaluate_function.txt. The echo however, does output in the browser. but it has some strange code in there:
<ul>
<li><a href="http://www.site.com/about/test">https://www.site.com/themes/site_themes/v4/imgs/flag_en.png EN</a></li>
<li><a href="http://fr.site.com/about/test">https://www.site.com/themes/site_themes/v4/imgs/flag_fr.png FR</a></li>
<li><a href="http://de.site.com/about/test">https://www.site.com/themes/site_themes/v4/imgs/flag_de.png DE</a></li>
<li><a href="http://sp.site.com/about/test<?php">https://www.site.com/themes/site_themes/v4/imgs/flag_sp.png SP</a></li>
<li><a href="http://it.site.com/about/test">https://www.site.com/themes/site_themes/v4/imgs/flag_it.png IT</a></li>
<li><a href="http://po.site.com/about/test<?php">https://www.site.com/themes/site_themes/v4/imgs/flag_br.png PO</a></li>
</ul>I mean what the hell is that on the last row!!!! <?php code being injected. It doesn’t show if I get rid of the top two li’s (or any combination)
Please can someone try this simple copy/paste test and let me know if you get the same error and any recommendations of things to try.
Would also be interested in an alternative solution to what the code is doing, when someone clicks the flag/link it redirects with all the same segments.
Tim