php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28997 Strange behaviour with exceptions
Submitted: 2004-07-02 20:06 UTC Modified: 2004-07-16 08:44 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:0 of 0 (0.0%)
From: jonathan dot lung at utoronto dot ca Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0RC3 OS: MacOS X 10.3
Private report: No CVE-ID: None
 [2004-07-02 20:06 UTC] jonathan dot lung at utoronto dot ca
Description:
------------
The exception handler seems to behave strangely.

Reproduce code:
---------------
<?
echo "loopy";
try {
	echo " code\n";
}
catch (Exception $e) {
	echo "Really.";
}
?>

Expected result:
----------------
The words "loopy code\n" to be printed out.

Actual result:
--------------
The words "loopy code\n" run in a continuous loop (yes, 
even the word "loopy").  This problem seems to go away 
with the following:

<?
if (true) {
	echo "loopy";
	try {
		echo " code\n";
	}
	catch (Exception $e) {
		echo "Really.";
	}
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-02 20:07 UTC] jonathan dot lung at utoronto dot ca
_
 [2004-07-02 21:05 UTC] jonathan dot lung at utoronto dot ca
if (true) {
	try {
		throw new Exception("Blah");
	} catch (Exception $e) {
		echo $e->getMessage();
	}
}

also does not behave as expected.  This causes an 
"uncaught exception" error to occur.  (Both problems 
listed occur from running from command line in 
interactive mode).  The above works if it is further 
surrounded by a try/catch block.
 [2004-07-16 08:44 UTC] helly@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 12:01:33 2025 UTC