diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-30 22:57:07 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-30 22:57:07 +0100 |
commit | d5c886ab7deef065c8119aaa545332041f13fe18 (patch) | |
tree | bb33dc724d134c05e69d30c03d71d0aab8255349 /Zend/tests | |
parent | 48b44612d4e3f2201aa3d069aedb89df7e0d1668 (diff) | |
parent | f77747b06c7623c4f673c75aebbe3372411a4275 (diff) | |
download | php-git-d5c886ab7deef065c8119aaa545332041f13fe18.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Properly propagate url_stat exceptions during include
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/bug60909_1.phpt | 4 | ||||
-rw-r--r-- | Zend/tests/exception_during_include_stat.phpt | 41 |
2 files changed, 42 insertions, 3 deletions
diff --git a/Zend/tests/bug60909_1.phpt b/Zend/tests/bug60909_1.phpt index d674490302..51b2dcae4c 100644 --- a/Zend/tests/bug60909_1.phpt +++ b/Zend/tests/bug60909_1.phpt @@ -11,14 +11,12 @@ set_error_handler(function($errno, $errstr, $errfile, $errline){ require 'notfound.php'; --EXPECTF-- error(require(notfound.php): failed to open stream: %s) -Warning: Uncaught Exception: Foo in %sbug60909_1.php:5 +Fatal error: Uncaught Exception: Foo in %sbug60909_1.php:5 Stack trace: #0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8) #1 %sbug60909_1.php(8): require() #2 {main} thrown in %sbug60909_1.php on line 5 -Fatal error: main(): Failed opening required 'notfound.php' (include_path='%s') in %sbug60909_1.php on line 8 - !!!shutdown!!! diff --git a/Zend/tests/exception_during_include_stat.phpt b/Zend/tests/exception_during_include_stat.phpt new file mode 100644 index 0000000000..1927e7e251 --- /dev/null +++ b/Zend/tests/exception_during_include_stat.phpt @@ -0,0 +1,41 @@ +--TEST-- +Make sure exceptions during include/require stating are properly propagated +--FILE-- +<?php + +class StreamWrapper { + public function url_stat($path, $flags) { + throw new Exception('stat failed'); + } +} + +stream_wrapper_register('test', StreamWrapper::class); +set_include_path('test://foo:test://bar'); + +try { + require_once 'doesnt_exist.php'; +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} +try { + require 'doesnt_exist.php'; +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} +try { + include_once 'doesnt_exist.php'; +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} +try { + include 'doesnt_exist.php'; +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +stat failed +stat failed +stat failed +stat failed |