php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31696 error in exception handling
Submitted: 2005-01-25 23:32 UTC Modified: 2005-03-19 15:40 UTC
From: gredata at yahoo dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.* OS: *
Private report: No CVE-ID: None
 [2005-01-25 23:32 UTC] gredata at yahoo dot com
Description:
------------
Hello 
I've installed apache2 and php-4.3.10
I copy from on-line documentation one part about exceptions just like is it and it is not working.
Look below.
Why you putted something in docs that is not working????


Reproduce code:
---------------
<?php
try {
   $error = 'Always throw this error';
   throw new Exception($error);

   // Code following an exception is not executed.
   echo 'Never executed';

} catch (Exception $e) {
   echo 'Caught exception: ',  $e->getMessage(), "\n";
}

// Continue execution
echo 'Hello World';
?> 

Expected result:
----------------
Caught exception: Always throw this error
Hello World

Actual result:
--------------
Parse error: parse error, unexpected '{' in /var/www/localhost/htdocs/testing/tt.php on line 2

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-25 23:36 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Where did you read that PHP 4.3.10 supports exceptions?
Exceptions are supported starting from 5.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 16:01:28 2024 UTC