diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 376b3ac1760f..21b90042f0fd 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -4,7 +4,6 @@ finfo_open(): Testing magic_file names fileinfo --FILE-- getMessage() . PHP_EOL; +} + +try { + var_dump($obj = new finfo(FILEINFO_MIME, 1.0)); +} catch (\Exception $e) { + echo $e->getMessage() . PHP_EOL; +} + +try { + var_dump($obj = new finfo(FILEINFO_MIME, '/foo/bar/inexistent')); +} catch (\Exception $e) { + echo $e->getMessage() . PHP_EOL; +} ?> --EXPECTF-- finfo_open(): Argument #2 ($magic_database) must not contain any null bytes @@ -45,3 +64,10 @@ Warning: finfo_open(%sinexistent): Failed to open stream: No such file or direct Warning: finfo_open(): Failed to load magic database at "%sinexistent" in %s on line %d bool(false) +object(finfo)#%d (%d) { +} +object(finfo)#%d (%d) { +} +finfo::__construct(%s123): Failed to open stream: No such file or directory +finfo::__construct(%s1): Failed to open stream: No such file or directory +finfo::__construct(%sinexistent): Failed to open stream: No such file or directory diff --git a/ext/fileinfo/tests/finfo_open_003.phpt b/ext/fileinfo/tests/finfo_open_003.phpt new file mode 100644 index 000000000000..39a45a61c6ff --- /dev/null +++ b/ext/fileinfo/tests/finfo_open_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +finfo_open(): Testing magic_file names +--EXTENSIONS-- +fileinfo +--FILE-- +getMessage() . PHP_EOL; +} +?> +--EXPECTF-- +bool(false) +TEST:Constructor failed diff --git a/ext/fileinfo/tests/finfo_open_004.phpt b/ext/fileinfo/tests/finfo_open_004.phpt new file mode 100644 index 000000000000..ff911bc75086 --- /dev/null +++ b/ext/fileinfo/tests/finfo_open_004.phpt @@ -0,0 +1,22 @@ +--TEST-- +finfo_open(): Testing magic_file names +--EXTENSIONS-- +fileinfo +--INI-- +open_basedir='.' +--FILE-- +getMessage() . PHP_EOL; +} +?> +--EXPECTF-- +Warning: finfo_open(): File name is longer than the maximum allowed path length on this platform (%d): %s in %s on line %d +bool(false) +TEST:finfo::__construct(): File name is longer than the maximum allowed path length on this platform (%d): %s