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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gredata at yahoo dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

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: Thu Jun 06 04:01:33 2024 UTC