Skip to content

Commit

Permalink
Dev Fixed PHP7 issue: Uninitialized string offset.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Jun 20, 2016
1 parent 10c63e5 commit a6ca80b
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions application/core/LSHttpRequest.php
Expand Up @@ -52,4 +52,40 @@ protected function normalizeRequest(){
}
}


public function getPathInfo()

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Jun 20, 2016

Contributor

Please add documentation.

This comment has been minimized.

Copy link
@SamMousa

SamMousa via email Jun 21, 2016

Author Contributor

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Jun 21, 2016

Contributor

For the function. phpdoc, I mean. Why and what.

This comment has been minimized.

Copy link
@SamMousa

SamMousa via email Jun 21, 2016

Author Contributor
{
if($this->_pathInfo===null)
{
$pathInfo=$this->getRequestUri();

if(($pos=strpos($pathInfo,'?'))!==false)
$pathInfo=substr($pathInfo,0,$pos);

$pathInfo=$this->decodePathInfo($pathInfo);

$scriptUrl=$this->getScriptUrl();
$baseUrl=$this->getBaseUrl();
if(strpos($pathInfo,$scriptUrl)===0)
$pathInfo=substr($pathInfo,strlen($scriptUrl));
elseif($baseUrl==='' || strpos($pathInfo,$baseUrl)===0)
$pathInfo=substr($pathInfo,strlen($baseUrl));
elseif(strpos($_SERVER['PHP_SELF'],$scriptUrl)===0)
$pathInfo=substr($_SERVER['PHP_SELF'],strlen($scriptUrl));
else
throw new CException(Yii::t('yii','CHttpRequest is unable to determine the path info of the request.'));

if($pathInfo==='/')
$pathInfo='';
elseif(!empty($pathInfo) && $pathInfo[0]==='/')
$pathInfo=substr($pathInfo,1);

if(($posEnd=strlen($pathInfo)-1)>0 && $pathInfo[$posEnd]==='/')
$pathInfo=substr($pathInfo,0,$posEnd);

$this->_pathInfo=$pathInfo;
}
return $this->_pathInfo;
}

}

0 comments on commit a6ca80b

Please sign in to comment.