Forum Moderators: coopster

Message Too Old, No Replies

Help with "Parse error"

         

HoopsMcCann

6:12 am on Apr 2, 2006 (gmt 0)

10+ Year Member



I'm getting the following error message on my phpbb forum when trying to view member profiles:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /var/www/html/forum/includes/usercp_viewprofile.php on line 189

Here is the code surrounding that line. Line 189 begins with "$u_search_author = urlencode(str_replace(array":



$page_title = $lang['Viewing_profile'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

if (function_exists('get_html_translation_table'))
{
$u_search_author = urlencode(strtr($profiledata['username'], array_flip(get_html_translation_table(HTML_ENTITIES))));
}
else
{
$u_search_author = urlencode(str_replace(array('&amp;', ''', '&quot;', '&lt;', '&gt;'), array('&', "'", '"', '<', '>'), $profiledata['username']));
}


Does anyone see what's wrong? TIA

HoopsMcCann

6:52 am on Apr 2, 2006 (gmt 0)

10+ Year Member



I think I fixed it, but would like someone with more experience than me to confirm that what I did makes sense. Within line 189, I changed this...



array('&amp;', ''', '&quot;', '&lt;', '&gt;'

...to this...



array('&amp;', "'", '&quot;', '&lt;', '&gt;'

The change was switching the second array value from single quotation marks (''') to double quotation marks ("'").

It seems to work on my forum, but I hope I did the right thing.

dreamcatcher

8:17 am on Apr 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

Yes, that is correct. You could also have escaped it:

array('&amp;', '\'', '&quot;', '&lt;', '&gt;')

The reason for the error is the script is getting confused as to where the line should terminate.

dc