Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

If value is array retrieve and use the associated response status message #647

Closed
wants to merge 1 commit into from

2 participants

@tlatsas

Variable $value may be an array. This removes annoying "Array to string conversion" notices like this:

Notice (8): Array to string conversion [CORE/Cake/Network/CakeResponse.php, line 461]

        $this->_setContentType();
        foreach ($this->_headers as $header => $value) {
            $this->_sendHeader($header, $value);

$name   =   'HTTP/1.1 200'
$value  =   array(
    (int) 200 => 'OK'
)
@tlatsas tlatsas If value is array retrieve and use the associated response status mes…
…sage

Do not assume value is always string. This removes annoying
"Array to string conversion" notices.
5324365
@markstory markstory commented on the diff
lib/Cake/Network/CakeResponse.php
@@ -375,6 +375,8 @@ public function send() {
$this->_setContentLength();
$this->_setContentType();
foreach ($this->_headers as $header => $value) {
+ if (is_array($value))
@markstory Owner

Missing { and } as per the coding standards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@markstory
Owner

How and why is the value an array?

@tlatsas

It seems there was a problem with my app controller implementation passing wrong argument in header(). I'm really sorry for the noise. Thanks.

@tlatsas tlatsas closed this
@markstory
Owner

No worries, I'm glad you got it figured out :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 11, 2012
  1. @tlatsas

    If value is array retrieve and use the associated response status mes…

    tlatsas authored
    …sage
    
    Do not assume value is always string. This removes annoying
    "Array to string conversion" notices.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/Cake/Network/CakeResponse.php
View
2  lib/Cake/Network/CakeResponse.php
@@ -375,6 +375,8 @@ public function send() {
$this->_setContentLength();
$this->_setContentType();
foreach ($this->_headers as $header => $value) {
+ if (is_array($value))
@markstory Owner

Missing { and } as per the coding standards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ $value = $value[$this->_status];
$this->_sendHeader($header, $value);
}
$this->_sendContent($this->_body);
Something went wrong with that request. Please try again.