Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 80 lines (65 sloc) 1.637 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
--TEST--
Test for bug #476: Exception chanining doesn't work
--SKIPIF--
<?php if (!version_compare(phpversion(), "5.3", '>=')) echo "skip >= PHP 5.3 needed\n"; ?>
--INI--
xdebug.default_enable=1
xdebug.dump.GET=
xdebug.dump.SERVER=
--FILE--
<?php

function a()
{
   throw new Exception('First exception');
}

function b()
{
try {
a();
} catch(Exception $e) {
throw new Exception('Second exception', 0, $e);
}
}

function c()
{
try {
b();
} catch(Exception $e) {
throw new Exception('Third exception', 0, $e);
}
}

function d()
{
try {
c();
} catch(Exception $e) {
throw new Exception('Fourth exception', 0, $e);
}
}

d();

echo "DONE\n";
?>
--EXPECTF--
Fatal error: Uncaught exception 'Exception' with message 'First exception' in %sbug00476-2.php on line 31

Exception: First exception in %sbug00476-2.php on line 5

Call Stack:
%w%f %w%d 1. {main}() %sbug00476-2.php:0
%w%f %w%d 2. d() %sbug00476-2.php:35
%w%f %w%d 3. c() %sbug00476-2.php:29
%w%f %w%d 4. b() %sbug00476-2.php:20
%w%f %w%d 5. a() %sbug00476-2.php:11

Exception: Second exception in %sbug00476-2.php on line 13

Call Stack:
%w%f %w%d 1. {main}() %sbug00476-2.php:0
%w%f %w%d 2. d() %sbug00476-2.php:35
%w%f %w%d 3. c() %sbug00476-2.php:29
%w%f %w%d 4. b() %sbug00476-2.php:20

Exception: Third exception in %sbug00476-2.php on line 22

Call Stack:
%w%f %w%d 1. {main}() %sbug00476-2.php:0
%w%f %w%d 2. d() %sbug00476-2.php:35
%w%f %w%d 3. c() %sbug00476-2.php:29

Exception: Fourth exception in %sbug00476-2.php on line 31

Call Stack:
%w%f %w%d 1. {main}() %sbug00476-2.php:0
%w%f %w%d 2. d() %sbug00476-2.php:35
Something went wrong with that request. Please try again.