As @CBroe noticed in comments:
Your comparison with NULL is just wrong here.
Check for empty'ness instead:
$fileInfo = pathinfo($this->outputPath);
if(empty($fileInfo['extension']))
{
unlink($fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['basename']);
}
Also, you missed a DIRECTORY_SEPARATOR
between the dirname
and the basename
.
Update: As @hassan pointed out, empty
is not the proper way to check for this either. That's because of directories .
and ..
on unix-like systems will pass this test, which is not desired.
So, the proper way to check for files without extension
would be:
if(isset($fileInfo['extension']) === false)
{
unlink($fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['basename']);
}