Skip to content

Incompatibility with PHP 7.4 line 52 src/Util/Str.php #507

@maietta

Description

@maietta

ERROR 500 - Internal Server Error
substr() expects parameter 1 to be string, bool given [/var/www/html/vendor/vlucas/phpdotenv/src/Util/Str.php:52]        

[vendor/vlucas/phpdotenv/src/Util/Str.php:52] substr()
[vendor/vlucas/phpdotenv/src/Store/File/Reader.php:76] Dotenv\Util\Str::utf8()
[vendor/phpoption/phpoption/src/PhpOption/Some.php:108] Dotenv\Store\File\Reader::Dotenv\Store\File\{closure}()
[vendor/vlucas/phpdotenv/src/Store/File/Reader.php:79] PhpOption\Some->flatMap()
[vendor/vlucas/phpdotenv/src/Store/File/Reader.php:48] Dotenv\Store\File\Reader::readFromFile()
[vendor/vlucas/phpdotenv/src/Store/FileStore.php:62] Dotenv\Store\File\Reader::read()
[vendor/vlucas/phpdotenv/src/Dotenv.php:222] Dotenv\Store\FileStore->read()
[global.php:32] Dotenv\Dotenv->load()
[process_tables.php:3] require('/var/www/html/global.php')

To fix this, I changed line 52  in /src/Util/Str.php from:

    if (\substr($converted, 0, 3) == "\xEF\xBB\xBF") {

to 

    if (\substr("$converted", 0, 3) == "\xEF\xBB\xBF") {

That appears to have "fixed" my problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions