I get the following error for just one particular entry in a channel entries tag, EE v2.1.3:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ben/work/goodwithfilm.com/httpdocs/admin/expressionengine/libraries/Functions.php(652) : eval()'d code on line 248I dug into it a bit and this is the PHP code that is trying to be eval’d:
<?php if("Gibney follows the money to construct a mesmerising portrayal of corruption, vested "" and hi") : ?>Here is the relevant portion of the template.
{if gwf_film_press_quote}
<div id="film_press" class="segment">
{gwf_film_press_quote}
{if "{row_count}"=="1"}
<ul class="press quotes">
{/if}
<li>
{if gwf_film_press_quote_snippet}
"<blockquote>{gwf_film_press_quote_snippet}</blockquote>" —
{/if}
{if gwf_film_press_quote_by}<h4>{if gwf_film_press_quote_link}<a href="http://{gwf_film_press_quote_link}">{/if}{gwf_film_press_quote_by} {if gwf_film_press_quote_stars}<span class="star_rating star_count_{gwf_film_press_quote_stars}">{gwf_film_press_quote_stars}/5</span>{/if}{if gwf_film_press_quote_link}</a>{/if}</h4><p>{/if}<br />
</li><br />
{if "{row_count}"=="{total_rows"}</ul>{/if}<br />
{/gwf_film_press_quote}<br />
<br />
</div><br />
<br />
{/if}
The line that is throwing the error is {if gwf_film_press_quote_snippet}. {gwf_film_press_quote} is a matrix field and {gwf_film_press_quote_snippet} is a text field column of the matrix.
This is a hexdump of the value of {gwf_film_press_quote_snippet} that is causing a problem. As you can see these are all ascii characters.
0000 47 69 62 6e 65 79 20 66 6f 6c 6c 6f 77 73 20 74 Gibney f ollows t
0010 68 65 20 6d 6f 6e 65 79 20 74 6f 20 63 6f 6e 73 he money to cons
0020 74 72 75 63 74 20 61 20 6d 65 73 6d 65 72 69 73 truct a mesmeris
0030 69 6e 67 20 70 6f 72 74 72 61 79 61 6c 20 6f 66 ing port rayal of
0040 20 63 6f 72 72 75 70 74 69 6f 6e 2c 20 76 65 73 corrupt ion, ves
0050 74 65 64 20 69 6e 74 65 72 65 73 74 73 20 61 6e ted inte rests an
0060 64 20 68 69 64 64 65 6e 20 61 67 65 6e 64 61 73 d hidden agendas
0070 20 74 68 61 74 20 77 6f 75 6c 64 20 68 61 76 65 that wo uld have
0080 20 6d 61 64 65 20 50 61 6b 75 6c 61 20 70 72 6f made Pa kula pro
0090 75 64 2e ud.Just as additional confirmation, If I comment out the if block, changing
{if gwf_film_press_quote_snippet}
"<blockquote>{gwf_film_press_quote_snippet}</blockquote>" —
{/if}to
{!--if gwf_film_press_quote_snippet}
"<blockquote>{gwf_film_press_quote_snippet}</blockquote>" —
{/if--}The error goes away. If delete the contents of this matrix cell, the error goes away. If I delete the word “interests”, or modify it in any way, the error goes away. If I delete the entire string leaving ” interests ” (importantly, with leading and trailing spaces), the error does NOT go away.
Digging further still I find the exact str_replace that introduces the problem. However, I find myself unable to penetrate the secrets of the prep_conditionals function, therefore my journey ends here.
File libraries/Functions.php, function prep_conditionals, line 2828:
$str = str_replace(array_keys($switch), array_values($switch), $str);Before this the surrounding template is:
l Film {if 3.4308751212E+39}<span class="star_rating star_count_4">4/5</span>{/if}{if 3.67160555933E+39}</a>{/if}</h4>{/if}
</li>
{if 3.483842626E+39==3.43878764003E+39}</ul>{/if}
{if 3.4308751212E+39==3.46593965166E+39}
<ul class="press quotes">
{/if}
<li>
{if "Gibney follows the money to construct a mesmerising portrayal of corruption, vested 3.61187285762E+39 and hi"}
"<blockquote>Gibney follows the money to construct a mesmerising portrayal of corruption, vested interests and hidden agendas that would have made Pakula proud.</blockquote>" —And after it is
ema/client-9">{/if}Total Film {if "4"}<span class="star_rating star_count_4">4/5</span>{/if}{if "http://www.totalfilm.com/reviews/cinema/client-9"}</a>{/if}</h4>{/if}
</li>
{if "3"=="{total_rows"}</ul>{/if}
{if "4"=="1"}
<ul class="press quotes">
{/if}
<li>
{if "Gibney follows the money to construct a mesmerising portrayal of corruption, vested "" and hi"}
"<blockquote>Gibney follows the money to construct a mesmerising portrayal of corruption, vested interests and hidden agendas that would have made Pakula proud.</blockquote>" —
{/if}The results of var_dump(array_keys($switch)); and var_dump(array_values($switch)); are
(continued below…)