getenv non covered system method
This error occurred when I cloned the develop branch and configured the env file

It looks as if genenv has not rewritten the system method
BASEPATH/Config\DotEnv.php at line 124,
setVariablemethod
/**
* Sets the variable into the environment. Will parse the string
* first to look for {name}={value} pattern, ensure that nested
* variables are handled, and strip it of single and double quotes.
*
* @param string $name
* @param string $value
*/
protected function setVariable(string $name, string $value = '')
{
list($name, $value) = $this->normaliseVariable($name, $value);
if (! getenv($name, true)) putenv("$name=$value");
if (empty($_ENV[$name])) $_ENV[$name] = $value;
if (empty($_SERVER[$name])) $_SERVER[$name] = $value;
}
What do you have set in your .env file?
yes, app and database
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
app.baseURL = 'localhost'
app.forceGlobalSecureRequests = false
app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'
app.sessionCookieName = 'ci_session'
app.sessionSavePath = NULL
app.sessionMachIP = false
app.sessionTimeToUpdate = 300
app.sessionRegenerateDestroy = false
app.cookiePrefix = ''
app.cookieDomain = ''
app.cookiePath = '/'
app.cookieSecure = false
app.cookieHTTPOnly = false
app.CSRFProtection = false
app.CSRFTokenName = 'csrf_test_name'
app.CSRFCookieName = 'csrf_cookie_name'
app.CSRFExpire = 7200
app.CSRFRegenerate = true
app.CSRFExcludeURIs = []
app.CSPEnabled = false
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
database.default.hostname = localhost
database.default.database = note
database.default.username = root
database.default.password = root
database.default.DBDriver = MySQLi
# database.tests.hostname = localhost
# database.tests.database = ci4
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
#--------------------------------------------------------------------
# CONTENT SECURITY POLICY
#--------------------------------------------------------------------
# contentsecuritypolicy.reportOnly = false
# contentsecuritypolicy.defaultSrc = 'none'
# contentsecuritypolicy.scriptSrc = 'self'
# contentsecuritypolicy.styleSrc = 'self'
# contentsecuritypolicy.imageSrc = 'self'
# contentsecuritypolicy.base_uri = null
# contentsecuritypolicy.childSrc = null
# contentsecuritypolicy.connectSrc = 'self'
# contentsecuritypolicy.fontSrc = null
# contentsecuritypolicy.formAction = null
# contentsecuritypolicy.frameAncestors = null
# contentsecuritypolicy.mediaSrc = null
# contentsecuritypolicy.objectSrc = null
# contentsecuritypolicy.pluginTypes = null
# contentsecuritypolicy.reportURI = null
# contentsecuritypolicy.sandbox = false
# contentsecuritypolicy.upgradeInsecureRequests = false
Hmm. What version of PHP are you using? According to PHP's own docs getenv() most definitely supports 2 parameters. Is there any chance you have something custom in your PHP setup that is overwriting the getenv function?
:flushed: , use PHP Version 7.0.8,Maybe I used the third party integrated development environment
phpstorm definition
/**
* Gets the value of an environment variable
* @link http://php.net/manual/en/function.getenv.php
* @param string $varname [optional] <p>
* The variable name.
* </p>
* @return string|array|false the value of the environment variable
* varname or array with all environment variables if no variable name
* provided, or false on an error.
* @since 4.0
* @since 5.0
* @since 7.1
*/
function getenv ($varname = null) {}
and
[root@localhost application]# php --rf getenv
Function [ <internal:standard> function getenv ] {
- Parameters [1] {
Parameter #0 [ <required> $varname ]
}
}
[root@localhost application]# php -v
PHP 7.0.8 (cli) (built: Jul 1 2016 15:48:39) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans
[root@localhost application]#
Did you figure out what was causing it?