This is a read-only archive. No new posts or registrations. Privacy Page
Software

PHP Parse Error

2 min read

This thread's last reply is from . Advice, software, and links below may be out of date — treat specific steps and download links with caution.

Looking for the outcome? Ask AI

Hi,
I was wondering if anyone can help me with a Parse Error with a script I am trying to install?

Parse error: syntax error, unexpected T_STRING in /home/trulykiw/public_html/admin/functions.php on line 1001

Thanks in advance
Bryce
Hi Bryce,

It will help if you post the code you have on line 1001 of functions.php. The error indicates that there is some syntax error on this line.
Thanks for the reply - I should have remembered to add the code, lol.

Line 990 to 1005 is as follows

if ($rs = $rss->get($rssurl)) {
for( $i = 0; $i < $limit; $i++){
$ret .= "

[image unavailable: image] ".$rs['items'][$i]['title']."

";
$ret .= "

";
$ret .= unhtmlspecialchars($rs['items'][$i]['description'])."

";
$ret .= "Read more";
$ret .= "
\n";
}
}
else {
$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at http://anonym.to/?http://www.phpsugar.com">Anonym zu www.phpsugar.com to stay up-to-date.";
}
return $ret;
}

The section in "red" is indicated to me as line 1001

Thanks again
Bryce
Than you that gives us something to work with :)

$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at "http://anonym.to/?http://www.phpsugar.com">Anonym zu www.phpsugar.com to stay up-to-date.";

It appears that the double quotes for the anchor tag is terminating the string prematurely. Try replacing them with double-double quotes (""http://anonym.to/?http://www.phpsugar.com"") or slash-double quote (\"http://anonym.to/?http://www.phpsugar.com\") and see if it works.
Hi Overbooked, thanks for the assistance - I will give that a try :)

edit:

completed suggestion….

applying double-double quote - no change - same message

applying slash-double quote - new message - as follows

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/trulykiw/public_html/admin/functions.php on line 1001

Parse error: syntax error, unexpected T_STRING in /home/trulykiw/public_html/admin/functions.php on line 1001


When I delete this entire function - line 990 to 1005 - the error disappears and I gain access to admin. BUT I am of course wondering if by doing so I am breaking something else.
Hi Bryce,

When I delete this entire function - line 990 to 1005 - the error disappears and I gain access to admin.

Great! You've identified the block as the only source of errors :thumbup:

BUT I am of course wondering if by doing so I am breaking something else.

Removing that section would definitely impact the functionality of the page. The block of code in the top section appears to be building a set/collection and iterating through it do display information (ie: RSS feed subscriptions).

Try replacing the code in red:

else {
$ret = "Sorry! Couldn't fetch the news. Please join our newsletter at http://anonym.to/?http://www.phpsugar.com">Anonym zu www.phpsugar.com to stay up-to-date.";
}

With the code block below:

$ret = "Sorry! Couldn't fetch the news. ";
//$ret .= "Please join our newsletter at ";
//$ret .= "Anonym zu www.phpsugar.com";
//$ret .= "to stay up-to-date.";
Let's try breaking down the string into 4 lines. If you get the code block above to work without errors, un-comment the next line (remove the // before the $ret) and try again. Hopefully you get all the way down to the 4th line without errors this time.

Ask AI

AI can make mistakes. Check the cited posts. Archived advice can be out-of-date

Don't include personal information. Questions and selected public posts go to OpenAI. About Ask AI