<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>144333</bug_id>
          
          <creation_ts>2015-04-28 09:23:13 -0700</creation_ts>
          <short_desc>[Win] PHP scripts fail if HTTP_ORIGIN is not set</short_desc>
          <delta_ts>2015-04-28 10:07:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=144157</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brent Fulgham">bfulgham</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1089548</commentid>
    <comment_count>0</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2015-04-28 09:23:13 -0700</bug_when>
    <thetext>For some reason, the Windows port does not populate the HTTP_ORIGIN header value:

&quot;Notice: Undefined index: HTTP_ORIGIN in C:\Projects\WebKit\OpenSource\LayoutTests\http\tests\security\resources\cors-post-redirect-target.php on line 5
There was no origin header&quot;

However, we appear to make all the same calls to &apos;setOrigin&apos; as the Mac port, which does provide this field in the HTTP header.

This discrepancy is causing these tests to fail (and perhaps others):

http/tests/security/cors-post-redirect-301.html
http/tests/security/cors-post-redirect-302.html
http/tests/security/cors-post-redirect-303.html
http/tests/security/cors-post-redirect-307.html
http/tests/security/cors-post-redirect-308.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089575</commentid>
    <comment_count>1</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2015-04-28 09:59:17 -0700</bug_when>
    <thetext>My initial understanding of this problem was wrong.

Tests are failing because of a difference in Windows PHP versus its behavior on the Mac:
(a) Mac treats a missing HTTP_ORIGIN &apos;key&apos; in the HTTP header as a null value.
(b) Win treats a missing HTTP_ORIGIN &apos;key&apos; in the HTTP header as a failure and terminates the script.

The fix is to check if the key is set before proceeding, which works properly on Windows and Mac.

I will do a quick search of other PHP files to see if this is the cause of other Windows failures.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089579</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2015-04-28 10:03:39 -0700</bug_when>
    <thetext>It doesn&apos;t appear that there are any other PHP tests suffering from this problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1089587</commentid>
    <comment_count>3</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2015-04-28 10:06:41 -0700</bug_when>
    <thetext>Committed r183483: &lt;http://trac.webkit.org/changeset/183483&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>