1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

This commit is contained in:
David Carlier
2025-01-19 18:01:52 +00:00
2 changed files with 27 additions and 0 deletions

View File

@@ -1368,6 +1368,9 @@ PHP_METHOD(SplFileInfo, getPathInfo)
if (ce == NULL) {
ce = intern->info_class;
} else if (!instanceof_function(ce, spl_ce_SplFileInfo)) {
zend_argument_type_error(1, "must be a class name derived from %s or null, %s given", ZSTR_VAL(spl_ce_SplFileInfo->name), ZSTR_VAL(ce->name));
RETURN_THROWS();
}
path = spl_filesystem_object_get_pathname(intern);

View File

@@ -0,0 +1,24 @@
--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