title: PHP cannot read cookies from Chrome in certain cases
body: <p>This issue appeared today and it seems to have something to do with webkit.</p>
  
  <p><strong>On pages that redirect via location [301/302] HTTP headers (404 error pages in this case) PHP cannot read the cookies - meaning the $_COOKIE is an empty array.</strong></p>
  
  <p>I'm aware of the webkit bug that using Set-Cookie and Location header in the same response breaks, but this is about reading not writing so it's supposed to be in the request headers.</p>
  
  <p>I'm using the latest Chrome v26. On the backend I have PHP 5.3.10-1ubuntu3.6 on my home server, and the exact same on a production server (which i did not set up and it's not on default settings). On the production server I cannot read the cookies as I said before but on my home/dev server I can.</p>
  
  <p>And it gets worse: On another server which runs PHP 5.3.3-7+squeeze14 I also can't read the cookies if the Content-Type header is not html, but text/plain.</p>
  
  <p>I set the cookies the following way:</p>
  
  <pre><code>if (setcookie($name, $value, $expire, $path, null, isset($_SERVER['HTTPS']), $httponly))
  {
      $_COOKIE[$name] = $value;
      return true;
  }
  return false;
  </code></pre>
  
  <ul>
  <li>$httponly is false</li>
  <li>$path is '/'</li>
  <li>the name consists of lowercase letters</li>
  <li>the value consists of numbers and dashes</li>
  </ul>
  
  <p>I can see the cookie in the Developer Tools / Resources tab and it works fine on simple html pages.</p>
  
  <p>I appreciate any help.
  Thanks.</p>