PHP 4.4.2 and eval() function

apps

#1

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”;


#2

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 . :slight_smile:


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK!! :@

You act on my advice at your own risk!


#3

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();


#4

Anybody?

The above eval code chokes on even the simplest code.

Example:

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