Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
f5219d24
Commit
f5219d24
authored
Nov 20, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Response status code default is 200
fixes #1220
parent
2d5f4e56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
Response.php
framework/yii/web/Response.php
+7
-13
No files found.
framework/yii/web/Response.php
View file @
f5219d24
...
@@ -126,9 +126,10 @@ class Response extends \yii\base\Response
...
@@ -126,9 +126,10 @@ class Response extends \yii\base\Response
*/
*/
public
$charset
;
public
$charset
;
/**
/**
* @var string
* @var string the HTTP status description that comes together with the status code.
* @see [[httpStatuses]]
*/
*/
public
$statusText
;
public
$statusText
=
'OK'
;
/**
/**
* @var string the version of the HTTP protocol to use. If not set, it will be determined via `$_SERVER['SERVER_PROTOCOL']`,
* @var string the version of the HTTP protocol to use. If not set, it will be determined via `$_SERVER['SERVER_PROTOCOL']`,
* or '1.1' if that is not available.
* or '1.1' if that is not available.
...
@@ -208,7 +209,7 @@ class Response extends \yii\base\Response
...
@@ -208,7 +209,7 @@ class Response extends \yii\base\Response
/**
/**
* @var integer the HTTP status code to send with the response.
* @var integer the HTTP status code to send with the response.
*/
*/
private
$_statusCode
;
private
$_statusCode
=
200
;
/**
/**
* @var HeaderCollection
* @var HeaderCollection
*/
*/
...
@@ -248,11 +249,6 @@ class Response extends \yii\base\Response
...
@@ -248,11 +249,6 @@ class Response extends \yii\base\Response
*/
*/
public
function
setStatusCode
(
$value
,
$text
=
null
)
public
function
setStatusCode
(
$value
,
$text
=
null
)
{
{
if
(
$value
===
null
)
{
$this
->
_statusCode
=
null
;
$this
->
statusText
=
null
;
return
;
}
$this
->
_statusCode
=
(
int
)
$value
;
$this
->
_statusCode
=
(
int
)
$value
;
if
(
$this
->
getIsInvalid
())
{
if
(
$this
->
getIsInvalid
())
{
throw
new
InvalidParamException
(
"The HTTP status code is invalid:
$value
"
);
throw
new
InvalidParamException
(
"The HTTP status code is invalid:
$value
"
);
...
@@ -297,10 +293,10 @@ class Response extends \yii\base\Response
...
@@ -297,10 +293,10 @@ class Response extends \yii\base\Response
{
{
$this
->
_headers
=
null
;
$this
->
_headers
=
null
;
$this
->
_cookies
=
null
;
$this
->
_cookies
=
null
;
$this
->
_statusCode
=
null
;
$this
->
_statusCode
=
200
;
$this
->
statusText
=
'OK'
;
$this
->
data
=
null
;
$this
->
data
=
null
;
$this
->
content
=
null
;
$this
->
content
=
null
;
$this
->
statusText
=
null
;
}
}
/**
/**
...
@@ -312,9 +308,7 @@ class Response extends \yii\base\Response
...
@@ -312,9 +308,7 @@ class Response extends \yii\base\Response
return
;
return
;
}
}
$statusCode
=
$this
->
getStatusCode
();
$statusCode
=
$this
->
getStatusCode
();
if
(
$statusCode
!==
null
)
{
header
(
"HTTP/
{
$this
->
version
}
$statusCode
{
$this
->
statusText
}
"
);
header
(
"HTTP/
{
$this
->
version
}
$statusCode
{
$this
->
statusText
}
"
);
}
if
(
$this
->
_headers
)
{
if
(
$this
->
_headers
)
{
$headers
=
$this
->
getHeaders
();
$headers
=
$this
->
getHeaders
();
foreach
(
$headers
as
$name
=>
$values
)
{
foreach
(
$headers
as
$name
=>
$values
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment