0

Hi all. I'm trying to move someone else's app onto a different server (and debug it in the process). Among the onslaught of bugs to squash, theres one I just cant get my head around... I get a parse error on try-catch, and I have no idea why. I've isolated the problem code and tested it on a virtual server -- no problems. I'm sure its server/ini settings that don't fit. Any ideas?

Parse error: syntax error, unexpected '{' in ~/includes/generate_pdf.php on line 15

Line 15 is 'try {'

try {
$pdf = Zend_Pdf::load(dirname(__FILE__)."/bla.pdf");
}
catch (Zend_Pdf_Exception $e) {
throw $e;
}

I've commented out all code surrounding this section and I still get the same error. Am I being a noob here?

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by rom.
0

I literally have removed everything. any try-catch statement and PHP rejects it with the same error. weirdest thing Ive ever seen.

0

Check the opening and closing of bracket '{}'. And make sure that all are properly nested.

It may due to the error above the line 15. It is helpful if you post the complete codes.

0

What version of php are you using on the new server?

yep, thats what the problem was. try-catch was introduced as of php 5, and the new server was running an older version of php.

cheers madCoder (and everyone else)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.