vlucas / phpdotenv

Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
BSD 3-Clause "New" or "Revised" License
13.1k stars 625 forks source link

Warning: array_key_exists(): The first argument should be either a string or an integer in {redacted local path}\vendor\vlucas\phpdotenv\src\Environment\Adapter\EnvConstAdapter.php on line 29 #350

Closed westernstatesflooring closed 5 years ago

westernstatesflooring commented 5 years ago

Hello,

I just upgraded Laravel 5.7 to 5.8 and now I'm getting the following error whenever loading the site as well as in the terminal.

Warning: array_key_exists(): The first argument should be either a string or an integer in {redacted local path}\vendor\vlucas\phpdotenv\src\Environment\Adapter\EnvConstAdapter.php on line 29

Warning: array_key_exists(): The first argument should be either a string or an integer in {redacted local path}\vendor\vlucas\phpdotenv\src\Environment\Adapter\ServerConstAdapter.php on line 29

Not sure if this is helpful, but when I print_r($name) just before line 29 on these files here is the output.

APP_ENVAPP_NAMEAPP_ENVAPP_KEYAPP_DEBUGAPP_URLLOG_CHANNELDB_CONNECTIONDB_HOSTDB_PORTDB_DATABASEDB_USERNAMEDB_PASSWORDLDAP_AUTO_CONNECTLDAP_ACCOUNT_PREFIXLDAP_ACCOUNT_SUFFIXLDAP_HOSTSLDAP_PORTLDAP_TIMEOUTLDAP_BASE_DNLDAP_USERNAMELDAP_PASSWORDLDAP_USE_SSLLDAP_USE_TLSBROADCAST_DRIVERCACHE_DRIVERQUEUE_CONNECTIONSESSION_DRIVERSESSION_LIFETIMEREDIS_HOSTREDIS_PASSWORDREDIS_PORTMAIL_DRIVERMAIL_HOSTMAIL_PORTMAIL_USERNAMEMAIL_PASSWORDMAIL_ENCRYPTIONPUSHER_APP_IDPUSHER_APP_KEYPUSHER_APP_SECRETPUSHER_APP_CLUSTERPUSHER_APP_KEYMIX_PUSHER_APP_KEYPUSHER_APP_CLUSTERMIX_PUSHER_APP_CLUSTERAPP_NAMEAPP_ENVAPP_DEBUGAPP_URLASSET_URLAPP_KEYAPP_ENVBACKPACK_REGISTRATION_OPENBACKPACK_LICENSEBROADCAST_DRIVERPUSHER_APP_KEYPUSHER_APP_SECRETPUSHER_APP_IDPUSHER_APP_CLUSTERCACHE_DRIVERMEMCACHED_PERSISTENT_IDMEMCACHED_USERNAMEMEMCACHED_PASSWORDMEMCACHED_HOSTMEMCACHED_PORTAPP_NAMECACHE_PREFIXDB_CONNECTIONDB_DATABASEDB_FOREIGN_KEYSDB_HOSTDB_PORTDB_DATABASEDB_USERNAMEDB_PASSWORDDB_SOCKETDB_HOSTDB_PORTDB_DATABASEDB_USERNAMEDB_PASSWORDDB_HOSTDB_PORTDB_DATABASEDB_USERNAMEDB_PASSWORDREDIS_HOSTREDIS_PASSWORDREDIS_PORTREDIS_DBREDIS_HOSTREDIS_PASSWORDREDIS_PORTREDIS_CACHE_DBFILESYSTEM_DRIVERFILESYSTEM_CLOUDAPP_URLAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGIONAWS_BUCKETAWS_URLBCRYPT_ROUNDSLDAP_AUTO_CONNECTLDAP_ACCOUNT_PREFIXLDAP_ACCOUNT_SUFFIXLDAP_HOSTSLDAP_PORTLDAP_TIMEOUTLDAP_BASE_DNLDAP_USERNAMELDAP_PASSWORDLDAP_USE_SSL LDAP_CONNECTIONLDAP_PASSWORD_SYNCLDAP_LOGIN_FALLBACKLOG_CHANNELLOG_SLACK_WEBHOOK_URLPAPERTRAIL_URLPAPERTRAIL_PORTLOG_STDERR_FORMATTERMAIL_DRIVERMAIL_HOSTMAIL_PORTMAIL_FROM_ADDRESSMAIL_FROM_NAMEMAIL_ENCRYPTIONMAIL_USERNAMEMAIL_PASSWORDMAIL_LOG_CHANNELQUEUE_CONNECTIONSQS_KEYSQS_SECRETSQS_PREFIXSQS_QUEUESQS_REGIONREDIS_QUEUEDB_CONNECTIONMAILGUN_DOMAINMAILGUN_SECRETMAILGUN_ENDPOINTSES_KEYSES_SECRETSES_REGIONSPARKPOST_SECRETSTRIPE_KEYSTRIPE_SECRETSTRIPE_WEBHOOK_SECRETSTRIPE_WEBHOOK_TOLERANCESESSION_DRIVERSESSION_LIFETIMESESSION_CONNECTIONSESSION_STOREAPP_NAMESESSION_COOKIESESSION_DOMAINSESSION_SECURE_COOKIEVIEW_COMPILED_PATHAPP_ENVBACKPACK_REGISTRATION_OPENBACKPACK_LICENSE

GrahamCampbell commented 5 years ago

It looks like you are calling env(null) somewhere, which is causing this warning. I might update the codebase to throw an exception so you can see a full stacktrace.

GrahamCampbell commented 5 years ago

@westernstatesflooring Please try with https://github.com/vlucas/phpdotenv/pull/351. This should show you were your bad function call is.

westernstatesflooring commented 5 years ago

351 created the exception report, found the stupid error in one of my config files. Thank you so much!