laserlight wrote:As far as I know, what you have tried should work on PHP 4.3.9
Have you tried a simpler test, e.g.
<?php
$str = "\"Sophie's world\"";
echo htmlentities($str, ENT_QUOTES);
?>
A million thank yous....this totally led me to my solution.
Your suggestion worked...on a raw string it was fine, so my problem is obviously the variable I'm operating on. In my class, I was using the $key=>$value output of a foreach() loop. Since $value is a copy of the original value, htmlentities isn't treating it the same for whatever reason (would you consider this a bug in the htmlentities function?). Anyway, instead of using $value, I use $array[$key], and it works (since this is the original variable and not a copy).
Bad code:
foreach($arg_tracks as $track_id=>$title)
{
if(strlen(trim($title))>0)
{
$tracks[$track_id]=trim(htmlentities($title), ENT_QUOTES);
}
}
Good code:
foreach($arg_tracks as $track_id=>$title)
{
if(strlen(trim($title))>0)
{
$tracks[$track_id]=trim(htmlentities($arg_tracks[$track_id]), ENT_QUOTES);
}
}
Thanks again,
Rich