Filename cannot be empty

Description

fopen()’s first argument is of type string, though the empty string is not allowed, as it does not lead to any file.

Example

<?php

fopen('', 'r');

?>

Solutions

  • Check the name of the file with empty() before using it with fopen().

  • Check the name of the file against ‘’ (empty string) before using it with fopen().