Closed Bug 504567 Opened 15 years ago Closed 6 years ago

String.split() fails when using patterns that can match empty string and pattern is not at the beginning of string

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX
Q1 12 - Brannan

People

(Reporter: brbaker, Unassigned)

References

Details

(Whiteboard: WE:2776977)

Attachments

(2 files)

Transferred bug from Adobe JIRA bug system: 
https://bugs.adobe.com/jira/browse/ASC-3628

String.split(pattern) will only match if the pattern is at the beginning of the string.

Test:
trace("ab".split(/a*/));
trace("abab".split(/a*/));
trace("babab".split(/a*/));

Actual Results:
,b
,bab
babab

Expected Results:
,b
,b,b
b,b,b

Expected results are produced by firefox
Flags: in-testsuite?
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Attached file testcase
Attachment #388914 - Flags: review?(dschaffe)
Attachment #388915 - Flags: review?(dschaffe)
Summary: String.split() fails when using patterns that can match not at the beginning of string → String.split() fails when using patterns that can match empty string and pattern is not at the beginning of string
Attachment #388914 - Flags: review?(dschaffe) → review+
Attachment #388915 - Flags: review?(dschaffe) → review+
This is not a recent injection, has been around since fp9
testcase pushed with "expectedfail" 2154:1103df25c6a4
Flags: in-testsuite? → in-testsuite+
Blocks: AS3_Builtins
Assignee: nobody → daumling
Status: NEW → ASSIGNED
Flags: flashplayer-qrb? → flashplayer-qrb+
Target Milestone: --- → flash10.1
Assignee: daumling → tharwood
Priority: -- → P3
I don't believe that PCRE can be configured to work as expected. ECMA-262 15.5.4.14 says:

"If separator is a regular expression, only the first match at a given position of the this string is considered, even if backtracking could yield a non-empty-substring match at that position."

In the particular test case, "a*" would expect to match "a" only, not the empty string as in "abab" (matching "a", then the empty string between the first "a" and "bab". String.split() expects the RegExp to be partially greedy.

This should be a documented deviation from ECMA-262 IMHO.
Any fix for this bug will likely need version-checking for backwards compatibility.
Reset in-testsuite to '?' as this will require version testing
Flags: in-testsuite+ → in-testsuite?
Flags: flashplayer-needsversioning+
Target Milestone: flash10.1 → Future
Priority: P3 → --
Depends on: 535770
we bug is assigned to Serrano.
Assignee: tharwood → nobody
Status: ASSIGNED → NEW
Flags: flashplayer-qrb+ → flashplayer-qrb?
Whiteboard: WE:2776977
Target Milestone: Future → ---
Target Milestone: --- → Q3 11 - Serrano
Target Milestone: Q3 11 - Serrano → Future
Target Milestone: Future → Q1 12 - Brannan
WE bug targeted to Brannan
Flags: flashplayer-qrb? → flashplayer-qrb+
Tamarin is a dead project now. Mass WONTFIX.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: