file_get_contents() Needs A Real Path

file_get_contents() cannot work on an empty string. Until PHP 8.0, it would report it as a warning, and return false, keeping the execution. In PHP 8.0, it is now a Fatal error.

PHP code

<?php

var_dump(file_get_contents(""));

?>

Before

PHP Warning:  file_get_contents(): Filename cannot be empty

Warning: file_get_contents(): Filename cannot be empty
bool(false)

After

PHP Fatal error:  Uncaught ValueError: Path cannot be empty

Fatal error: Uncaught ValueError: Path cannot be empty

PHP version change

This behavior changed in 8.0

Error Messages