PHP 4.4.2 and eval() function

PHP 4.4.2 and eval() function

Posted by: Themicles
Posted on: 2006-08-02 10:04:00

I am having trouble running ANY PHP through the eval() function without it giving the following error:

"Parse error: syntax error, unexpected $end"

This happens even when trying a simple echo:

echo "Testing...1...2...3";

Re: PHP 4.4.2 and eval() function

Posted by: norm1037
Posted on: 2006-08-02 10:17:00

You may want to put the full PHP script in and then someone can look it over and help you.

Otherwise from your message I could say...

I see no eval() function in you single line of code
Or, you are missing <?php and ?> from your single line....

So add a bit more to your question and see what happens . smile


--
Norm


Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! mad

You act on my advice at your own risk!

Re: PHP 4.4.2 and eval() function

Posted by: Themicles
Posted on: 2006-08-02 10:43:00

The code with the eval is below, with the lines before, and after it.

This code worked fine on the site's previous host and has not changed since I moved the site to Dreamhost. I do not know the software versions on the previous host.

// In order to allow PHP code to be parsed from a database field, the contents must be eval()'ed.
// The eval()'ed code will try to pass to the browser immediately so we use output buffering to capture it.
ob_start();

// The line below CAN NOT BE REMOVED! The embedded PHP code will be parsed and will cause errors.
eval(' ?>' . $page_array['content'] . '<?php ');

// Captured the parsed content and clean the output buffer.
$page_array['content'] = ob_get_contents();
ob_end_clean();

Re: PHP 4.4.2 and eval() function

Posted by: Themicles
Posted on: 2006-08-04 22:47:00

Anybody?

The above eval code chokes on even the simplest code.

Example:

<?php
echo "Testing...1...2...3...";
?>

Tags: echo echophp 4parse errorsyntax errorrunning