<?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>10436</bug_id>
          
          <creation_ts>2006-08-16 09:48:58 -0700</creation_ts>
          <short_desc>Safari May Not Interpret Regular Expression in Compliance with W3C Standard</short_desc>
          <delta_ts>2006-12-06 09:36:50 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>javascript:alert(&apos;\u00e9&apos;.match(new RegExp(&apos;\\u00e9&apos;)))</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eduardo Foresti">solutionarchitecture</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>jonathanjohnsson</cc>
    
    <cc>solutionarchitecture</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>52725</commentid>
    <comment_count>0</comment_count>
    <who name="Eduardo Foresti">solutionarchitecture</who>
    <bug_when>2006-08-16 09:48:58 -0700</bug_when>
    <thetext>We are troubleshooting why some websites are no longer working when rendered with the Safari 2.0.4 browser. The failure begins when client entered data is validated using regular expressions.  So, we validate that a User&apos;s UserID and Password are &apos;valid&apos; using the regex - since the regex is failing, a user cannot enter the site.  This only began with 10.4.7 and 2.0.4 of Safari.  Also note that it continues to work on 10.4.7 using IE and FireFox.

We have determined no other place to go than to you.

We seem to have localized the issue to Safari&apos;s not interpretting regular expressions consistently. 

For example, we looked at the follwing tests:
&gt; Does the regex \u00e9 match the literal character é? (Validates the regular expression engine understands Unicode escape sequences for extended characters.)? - NO, but it does on IE and FireFox

&gt; Does the regex \u0041 match the literal character A? (Validates the regular expression engine understands Unicode escape sequences for ASCII characters.)? - NO, but it does on IE and FireFox

&gt;Does the regex é match the literal character é? (Validates the regular expression engine understands literal characters outside the ASCII range – this is against ECMAScript spec.)? - Sometimes, but always on IE and FireFox

&gt; Write a Unicode escape sequence to the screen on the client side. (Validates the string parsing and display in the JS engine works.) - Works on all 3

&gt; Is escape sequence \u00e9 equivalent to literal character é? (Validates the string functionality in the JS engine works with extended characters.)? Yes on all 3.

&gt; Is escape sequence \u0041 equivalent to literal character A? (Validates the string functionality in the JS engine works with ASCII characters.)? Yes on all 3

&gt; Does the regex A match the literal character A? (Validates the regular expression engine understands literal characters in the ASCII range – this is ECMAScript spec.)? Yes on all 3

Please help. It&apos;s hard for me to believe that the regular expression / javascript interpreter(s) for Safari aren&apos;t working as they have in the past - but all roads are pointed that way....

Thank you for your review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52773</commentid>
    <comment_count>1</comment_count>
    <who name="">jonathanjohnsson</who>
    <bug_when>2006-08-16 13:04:09 -0700</bug_when>
    <thetext>If you need to confirm that the issues indeed were introduced in Safari 2.0.4, you could try an earlier version from Multi-Safari at http://www.michelf.com/projects/multi-safari/ (be sure to read the &quot;known issues&quot; part of that page).

It would help if you could create a simple test case and attach to this bug report, demonstrating what you say in the description, so it can be easily verifiable what different browsers do, and what has changed in between versions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52774</commentid>
    <comment_count>2</comment_count>
    <who name="Eduardo Foresti">solutionarchitecture</who>
    <bug_when>2006-08-16 13:25:31 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; If you need to confirm that the issues indeed were introduced in Safari 2.0.4,
&gt; you could try an earlier version from Multi-Safari at
&gt; http://www.michelf.com/projects/multi-safari/ (be sure to read the &quot;known
&gt; issues&quot; part of that page).
&gt; It would help if you could create a simple test case and attach to this bug
&gt; report, demonstrating what you say in the description, so it can be easily
&gt; verifiable what different browsers do, and what has changed in between
&gt; versions.


Thank you for your response(In reply to comment #1)
&gt; We were able to confirm across other Browsers and that this did work in prior versions.  Thanks for the tip to MultiSafari - this will be very helpful in the future.
&gt; In re: to the test case, attached is a standard HTML page with some very simple client-side code that can be used to test Unicode character handling both in and out of regular expressions in JavaScript.  This page is slightly modified from the original source at http://www.regular-expressions.info/javascriptexample.html - it is simplified (no ads or additional text) and adds some tests that the original page does not.  Tests include:

&gt;&gt;Does a Unicode escape sequence properly get interpreted when written to the screen? 
&gt;&gt;If you compare a Unicode escape sequence to its literal character interpretation, are they equivalent? 
&gt;&gt;Given a regular expression, does a given input match? 
 
Save the attached file with a .html extension and open it up in the browser to run the tests.

Given:
Unicode sequence “\u00e9” is the equivalent of “é” 
Unicode sequence “\u0041” is the equivalent of “A” 
 
I tested in IE 6 on Windows, IE on Mac, and Safari 2.0.4 on Mac.  The IE and Safari browsers were on the same physical Mac. As you can see from the test results (in the orginal post), the string functionality in all of the JavaScript implementations works but the regular expression engines did not always work.

Attached is a standard HTML page with some very simple client-side code that can be used to test Unicode character handling both in and out of regular expressions in JavaScript.  This page is slightly modified from the original source at http://www.regular-expressions.info/javascriptexample.html - it is simplified (no ads or additional text) and adds some tests that the original page does not.  Tests include:

Does a Unicode escape sequence properly get interpreted when written to the screen? 
If you compare a Unicode escape sequence to its literal character interpretation, are they equivalent? 
Given a regular expression, does a given input match? 
 

Save the attached file with a .html extension and open it up in the browser to run the tests.

Given:
Unicode sequence “\u00e9” is the equivalent of “é” 
Unicode sequence “\u0041” is the equivalent of “A” 
 

I tested in IE 6 on Windows, IE on Mac, and Safari 2.0.4 on Mac.  The IE and Safari browsers were on the same physical Mac. As you can see from the test results, the string functionality in all of the JavaScript implementations works but the regular expression engines did not always work.

I did not test every single FI regular expression however the ones I did test further proved the theory.  Anything with a \u sequence didn’t work; very simple expressions allowing no extended characters worked.

Conclusion - The JavaScript regular expression implementation in this version of Safari is wrong.  
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52775</commentid>
    <comment_count>3</comment_count>
      <attachid>10076</attachid>
    <who name="Eduardo Foresti">solutionarchitecture</who>
    <bug_when>2006-08-16 13:31:43 -0700</bug_when>
    <thetext>Created attachment 10076
Test File for Proving Hypothesis RE: Bug 10436

Note: NOT A PATCH.  The attached was derived from a file provided by the firm indicated in the file.  I do not represent this is my work, nor am I implying or suggesting its use is for anything other than the testing of this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52782</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-08-16 14:10:10 -0700</bug_when>
    <thetext>Test case: javascript:alert(&apos;\u00e9&apos;.match(new RegExp(&apos;\\u00e9&apos;)))

Downgrading severity (blocker is for bugs that block WebKit development). Once confirmed as a regression, this should be P1 priority, of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53405</commentid>
    <comment_count>5</comment_count>
    <who name="Eduardo Foresti">solutionarchitecture</who>
    <bug_when>2006-10-11 21:02:32 -0700</bug_when>
    <thetext>(In reply to comment #4)

Any thoughts on this?  It seems to not have changed?  We took the patch for ID: 6257 and it FULLY addressed this issue, but, it appears that 6257 is being held up for release b/c it has become the child of a master bug (7383).  I still have thousands of customers that I&apos;m pushing to FF and IE.  Any idea how to find out if 6257 or 7383 will be made available to the public?  I don&apos;t have anything to tell my customers.  Can you help?

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53168</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-10-15 01:35:28 -0700</bug_when>
    <thetext>I have tried to confirm this as a regression using Multi-Safari, but I&apos;m getting the same results from &quot;Safari 2.0&quot;. If you could point out what exactly broke in 10.4.7, this would raise the priority of this issue to P1 (the highest), which would likely lead to a quick fix.

My understanding is that the proposed fix in bug 6257 was not good enough to be accepted, so we still need someone to write a better one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>43091</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-12-06 09:36:50 -0800</bug_when>
    <thetext>This was fixed recently.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>10076</attachid>
            <date>2006-08-16 13:31:43 -0700</date>
            <delta_ts>2006-08-16 13:31:43 -0700</delta_ts>
            <desc>Test File for Proving Hypothesis RE: Bug 10436</desc>
            <filename>regextester.rename_to_html</filename>
            <type>text/html</type>
            <size>1915</size>
            <attacher name="Eduardo Foresti">solutionarchitecture</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwv
L0VOIj4NCjwhLS0gc2F2ZWQgZnJvbSB1cmw9KDAwNTgpaHR0cDovL3d3dy5yZWd1bGFyLWV4cHJl
c3Npb25zLmluZm8vamF2YXNjcmlwdGV4YW1wbGUuaHRtbCAtLT4NCjxodG1sPg0KCTxoZWFkPg0K
CQk8dGl0bGU+UmVndWxhciBFeHByZXNzaW9uIFRlc3RlcjwvdGl0bGU+DQoJPC9oZWFkPg0KCTxi
b2R5IHRleHQ9ImJsYWNrIiBiZ0NvbG9yPSJ3aGl0ZSI+DQoNCjxoMT5SZWd1bGFyIEV4cHJlc3Np
b24gVGVzdGVyPC9oMT4NCjxzY3JpcHQgbGFuZ3VhZ2U9IkphdmFTY3JpcHQiPgoNCmRvY3VtZW50
LndyaXRlKCJVbmljb2RlIGVzY2FwZSBzZXF1ZW5jZSBcXHUwMGU5OiBcdTAwZTk8YnIgLz4iKTsN
CmRvY3VtZW50LndyaXRlKCJMaXRlcmFsIGNoYXIgPT0gVW5pY29kZSB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