Open renaatdemuynck opened 9 years ago
UPDATE
Apparently PHP fixed most of the security issues with SplFileObject
.
Further testing reveils the following:
SafeFileTest
pass if the tests are run against SplFileObject
instead of SafeFile
and all tests expect RuntimeException
instead of EnterpriseSecurityException
or ValidationException
.SafeFileTest::testSafeFileWithDevNullAndPercentEncoding
Solution:
Do we still really need SafeFile
? Should it be marked deprecated? Anyway, if we want SafeFile
to throw ValidationException
s, the sanity checks should be performed before the SplFileObject::__constructor is called.
SafeFileTest::testURILocal
fails because SafeFile throwsEnterpriseSecurityException
instead ofValidationException
. This is because in more recent versions of PHP, when you inject a nul byte in the path, the classSplFileObject
throwsRuntimeException
with message _'SplFileObject::_construct() expects parameter 1 to be a valid path, string given'. In older versions of PHP aValidationException
would have been thrown. This should be fixed by running the sanity checks before theSplFileObject::__constructor
is called.Tested on: