diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-11-25 07:57:01 -0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-11-25 08:00:20 -0800 |
commit | 4a7e83f54aeb6d5464da6cc2b201ce47a23a88d9 (patch) | |
tree | bb12fed2ee910c4427a9a70b0b63d9294a13aa99 /tests | |
parent | 0394c04144db62687a5e04f48e14bf1bbffd51f7 (diff) | |
download | php-git-4a7e83f54aeb6d5464da6cc2b201ce47a23a88d9.tar.gz |
Fixed bug #70970 (Segfault when combining error handler with output buffering)
of course we can try to refactor the current flow to make this error can
be catched safly.
but as 7.0.0 is releasing, I don't think a refactor is safe now. and
actually I don't see any gain to make this catchable.
so let's keep this be consistent with 5.6 and safe for now
Diffstat (limited to 'tests')
-rw-r--r-- | tests/output/bug65593.phpt | 4 | ||||
-rw-r--r-- | tests/output/bug70970.phpt | 28 | ||||
-rw-r--r-- | tests/output/ob_010.phpt | 2 | ||||
-rw-r--r-- | tests/output/ob_011.phpt | 2 | ||||
-rw-r--r-- | tests/output/ob_start_error_005.phpt | 2 |
5 files changed, 33 insertions, 5 deletions
diff --git a/tests/output/bug65593.phpt b/tests/output/bug65593.phpt index 9ae62a1d72..3375a6bf08 100644 --- a/tests/output/bug65593.phpt +++ b/tests/output/bug65593.phpt @@ -6,8 +6,8 @@ echo "Test\n"; ob_start(function(){ob_start();}); ?> -===DONE=== --EXPECTF-- Test -Catchable fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %sbug65593.php on line %d +Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %sbug65593.php on line %d + diff --git a/tests/output/bug70970.phpt b/tests/output/bug70970.phpt new file mode 100644 index 0000000000..87cc1b71c3 --- /dev/null +++ b/tests/output/bug70970.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #70970 (Segfault when combining error handler with output buffering) +--FILE-- +<?php +function exception_error_handler($severity, $message, $file, $line) +{ + throw new Exception($message, 0, $severity, $file, $line); +} + +set_error_handler('exception_error_handler'); + +function obHandler($buffer, $phase = null) +{ + try { + ob_start(); + } catch (Exception $e) { + return (string) $e; + } + + return $buffer; +} + +ob_start('obHandler'); + +print 'test'; +?> +--EXPECTF-- +Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %sbug70970.php on line %d diff --git a/tests/output/ob_010.phpt b/tests/output/ob_010.phpt index 3e0c1a46e5..24d650c50d 100644 --- a/tests/output/ob_010.phpt +++ b/tests/output/ob_010.phpt @@ -10,4 +10,4 @@ ob_start("obh"); echo "foo\n"; ?> --EXPECTF-- -Catchable fatal error: print_r(): Cannot use output buffering in output buffering display handlers in %sob_010.php on line %d +Fatal error: print_r(): Cannot use output buffering in output buffering display handlers in %sob_010.php on line %d diff --git a/tests/output/ob_011.phpt b/tests/output/ob_011.phpt index a411debe17..35b0388339 100644 --- a/tests/output/ob_011.phpt +++ b/tests/output/ob_011.phpt @@ -10,4 +10,4 @@ ob_start("obh"); echo "foo\n"; ?> --EXPECTF-- -Catchable fatal error: ob_get_flush(): Cannot use output buffering in output buffering display handlers in %sob_011.php on line %d +Fatal error: ob_get_flush(): Cannot use output buffering in output buffering display handlers in %sob_011.php on line %d diff --git a/tests/output/ob_start_error_005.phpt b/tests/output/ob_start_error_005.phpt index ebe625504b..134f2249b7 100644 --- a/tests/output/ob_start_error_005.phpt +++ b/tests/output/ob_start_error_005.phpt @@ -20,4 +20,4 @@ var_dump(ob_start('f')); echo "done"; ?> --EXPECTF-- -Catchable fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %s on line 9 +Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %s on line 9 |