mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
update super global access to gracefully handle unset super global vars
This commit is contained in:
@@ -579,16 +579,27 @@ class Smarty
|
||||
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
|
||||
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
|
||||
|
||||
$this->_supers['get'] = $this->request_use_auto_globals ? $_GET : $GLOBALS['HTTP_GET_VARS'];
|
||||
$this->_supers['post'] = $this->request_use_auto_globals ? $_POST : $GLOBALS['HTTP_POST_VARS'];
|
||||
$this->_supers['server'] = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
|
||||
if(isset($_SESSION))
|
||||
$this->_supers['session'] = $this->request_use_auto_globals ? $_SESSION : $GLOBALS['HTTP_SESSION_VARS'];
|
||||
else
|
||||
$this->_supers['session'] = array();
|
||||
$this->_supers['request'] = $this->request_use_auto_globals ? $_REQUEST : $GLOBALS['HTTP_REQUEST_VARS'];
|
||||
$this->_supers['cookies'] = $this->request_use_auto_globals ? $_COOKIE : $GLOBALS['HTTP_COOKIE_VARS'];
|
||||
$this->_supers['env'] = $this->request_use_auto_globals ? $_ENV : $GLOBALS['HTTP_ENV_VARS'];
|
||||
$this->_supers['get'] = $this->request_use_auto_globals
|
||||
? (isset($_GET) ? $_GET : array())
|
||||
: $GLOBALS['HTTP_GET_VARS'];
|
||||
$this->_supers['post'] = $this->request_use_auto_globals
|
||||
? (isset($_POST) ? $_POST : array())
|
||||
: $GLOBALS['HTTP_POST_VARS'];
|
||||
$this->_supers['server'] = $this->request_use_auto_globals
|
||||
? (isset($_SERVER) ? $_SERVER : array())
|
||||
: $GLOBALS['HTTP_SERVER_VARS'];
|
||||
$this->_supers['session'] = $this->request_use_auto_globals
|
||||
? (isset($_SESSION) ? $_SESSION : array())
|
||||
: $GLOBALS['HTTP_SESSION_VARS'];
|
||||
$this->_supers['request'] = $this->request_use_auto_globals
|
||||
? (isset($_REQUEST) ? $_REQUEST : array())
|
||||
: $GLOBALS['HTTP_REQUEST_VARS'];
|
||||
$this->_supers['cookies'] = $this->request_use_auto_globals
|
||||
? (isset($_COOKIE) ? $_COOKIE : array())
|
||||
: $GLOBALS['HTTP_COOKIE_VARS'];
|
||||
$this->_supers['env'] = $this->request_use_auto_globals
|
||||
? (isset($_ENV) ? $_ENV : array())
|
||||
: $GLOBALS['HTTP_ENV_VARS'];
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user