-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 #2 must be a class name derived from SplFileInfo or null, BadSplFileInfo given |