1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/gh17516.phpt
David Carlier c82e31b026 Fix GH-17516: SplFileTempObject::getPathInfo() crash on invalid class.
This no longer caught the case where an non SplFileInfo/inherited class
of nwas passed since the refactoring in 8.4.

close GH-17517
2025-01-19 18:01:02 +00:00

25 lines
634 B
PHP

--TEST--
GH-17516 SplTempFileObject::getPathInfo() crashes on invalid class ID.
--FILE--
<?php
$cls = new SplTempFileObject();
class SplFileInfoChild extends SplFileInfo {}
class BadSplFileInfo {}
var_dump($cls->getPathInfo('SplFileInfoChild'));
try {
$cls->getPathInfo('BadSplFileInfo');
} catch (\TypeError $e) {
echo $e->getMessage();
}
?>
--EXPECT--
object(SplFileInfoChild)#2 (2) {
["pathName":"SplFileInfo":private]=>
string(4) "php:"
["fileName":"SplFileInfo":private]=>
string(4) "php:"
}
SplFileInfo::getPathInfo(): Argument #1 ($class) must be a class name derived from SplFileInfo or null, BadSplFileInfo given