"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/web/CHttpRequest.php" between
yii-1.1.21.733ac5.tar.gz and yii-1.1.22.bf1d26.tar.gz

About: Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Hint: Yii 1.1 is now in maintenance mode.

CHttpRequest.php  (yii-1.1.21.733ac5):CHttpRequest.php  (yii-1.1.22.bf1d26)
skipping to change at line 129 skipping to change at line 129
} }
/** /**
* Normalizes the request data. * Normalizes the request data.
* This method strips off slashes in request data if get_magic_quotes_gpc () returns true. * This method strips off slashes in request data if get_magic_quotes_gpc () returns true.
* It also performs CSRF validation if {@link enableCsrfValidation} is tr ue. * It also performs CSRF validation if {@link enableCsrfValidation} is tr ue.
*/ */
protected function normalizeRequest() protected function normalizeRequest()
{ {
// normalize request // normalize request
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gp c()) if(version_compare(PHP_VERSION,'7.4.0','<'))
{ {
if(isset($_GET)) if(function_exists('get_magic_quotes_gpc') && get_magic_q
$_GET=$this->stripSlashes($_GET); uotes_gpc())
if(isset($_POST)) {
$_POST=$this->stripSlashes($_POST); if(isset($_GET))
if(isset($_REQUEST)) $_GET=$this->stripSlashes($_GET);
$_REQUEST=$this->stripSlashes($_REQUEST); if(isset($_POST))
if(isset($_COOKIE)) $_POST=$this->stripSlashes($_POST);
$_COOKIE=$this->stripSlashes($_COOKIE); if(isset($_REQUEST))
$_REQUEST=$this->stripSlashes($_REQUEST);
if(isset($_COOKIE))
$_COOKIE=$this->stripSlashes($_COOKIE);
}
} }
if($this->enableCsrfValidation) if($this->enableCsrfValidation)
Yii::app()->attachEventHandler('onBeginRequest',array($th is,'validateCsrfToken')); Yii::app()->attachEventHandler('onBeginRequest',array($th is,'validateCsrfToken'));
} }
/** /**
* Strips slashes from input data. * Strips slashes from input data.
* This method is applied when magic quotes is enabled. * This method is applied when magic quotes is enabled.
* @param mixed $data input data to be processed * @param mixed $data input data to be processed
skipping to change at line 1522 skipping to change at line 1525
/** /**
* Sends a cookie. * Sends a cookie.
* @param CHttpCookie $cookie cookie to be sent * @param CHttpCookie $cookie cookie to be sent
*/ */
protected function addCookie($cookie) protected function addCookie($cookie)
{ {
$value=$cookie->value; $value=$cookie->value;
if($this->_request->enableCookieValidation) if($this->_request->enableCookieValidation)
$value=Yii::app()->getSecurityManager()->hashData(seriali ze($value)); $value=Yii::app()->getSecurityManager()->hashData(seriali ze($value));
if(version_compare(PHP_VERSION,'5.2.0','>=')) if(version_compare(PHP_VERSION,'7.3.0','>='))
setcookie($cookie->name,$value,$this->getCookieOptions($c
ookie));
elseif(version_compare(PHP_VERSION,'5.2.0','>='))
setcookie($cookie->name,$value,$cookie->expire,$cookie->p ath,$cookie->domain,$cookie->secure,$cookie->httpOnly); setcookie($cookie->name,$value,$cookie->expire,$cookie->p ath,$cookie->domain,$cookie->secure,$cookie->httpOnly);
else else
setcookie($cookie->name,$value,$cookie->expire,$cookie->p ath,$cookie->domain,$cookie->secure); setcookie($cookie->name,$value,$cookie->expire,$cookie->p ath,$cookie->domain,$cookie->secure);
} }
/** /**
* Deletes a cookie. * Deletes a cookie.
* @param CHttpCookie $cookie cookie to be deleted * @param CHttpCookie $cookie cookie to be deleted
*/ */
protected function removeCookie($cookie) protected function removeCookie($cookie)
{ {
if(version_compare(PHP_VERSION,'5.2.0','>=')) $cookie->expire=0;
setcookie($cookie->name,'',0,$cookie->path,$cookie->domai if(version_compare(PHP_VERSION,'7.3.0','>='))
n,$cookie->secure,$cookie->httpOnly); setcookie($cookie->name,'',$this->getCookieOptions($cooki
e));
elseif(version_compare(PHP_VERSION,'5.2.0','>='))
setcookie($cookie->name,'',$cookie->expire,$cookie->path,
$cookie->domain,$cookie->secure,$cookie->httpOnly);
else else
setcookie($cookie->name,'',0,$cookie->path,$cookie->domai setcookie($cookie->name,'',$cookie->expire,$cookie->path,
n,$cookie->secure); $cookie->domain,$cookie->secure);
}
/**
* Builds the setcookie $options parameter.
* @param CHttpCookie $cookie
* @return array
*/
protected function getCookieOptions($cookie)
{
return array(
'expires'=>$cookie->expire,
'path'=>$cookie->path,
'domain'=>$cookie->domain,
'secure'=>$cookie->secure,
'httpOnly'=>$cookie->httpOnly,
'sameSite'=>$cookie->sameSite
);
} }
} }
 End of changes. 5 change blocks. 
15 lines changed or deleted 43 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)