Side navigation
#8054 closed bug (fixed)
Opened January 25, 2011 06:35PM UTC
Closed January 25, 2011 11:56PM UTC
Last modified January 28, 2011 01:07PM UTC
Regex in ajaxPrefilter of JSON data type should not be valid
Reported by: | Soul_Master@live.com | Owned by: | jaubourg |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | ajax | Version: | 1.5rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { dataIsString = ( typeof s.data === "string" ); if ( s.dataTypes[ 0 ] === "jsonp" || originalSettings.jsonpCallback || originalSettings.jsonp != null || s.jsonp !== false && ( jsre.test( s.url ) || dataIsString && jsre.test( s.data ) ) ) {
From the above code, jQuery use jsre Regex to test current data. It return true when my data contain "?" symbol that is cause of bug when it process callback data as script instead of Json. The following code is my Json result that is generated by .NET JSON serializer. It can be correctly parsed when parser is parseJSON function instead of globalEval function.
{"ErrorList":{},"IsComplete":true,"RedirectTo":null,"ResultData":null}
Thanks,
Attachments (0)
Change History (7)
Changed January 25, 2011 06:37PM UTC by comment:1
Changed January 25, 2011 06:57PM UTC by comment:2
component: | unfiled → ajax |
---|---|
owner: | → Soul_Master@live.com |
status: | new → pending |
Thanks for taking the time to contribute to the jQuery project by writing a bug report.
Please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further.
Changed January 25, 2011 11:12PM UTC by comment:3
owner: | Soul_Master@live.com → jaubourg |
---|---|
status: | pending → assigned |
Changed January 25, 2011 11:22PM UTC by comment:4
priority: | undecided → high |
---|
test case check the inline comments
Introduced with the fix for #4897.
Related reading http://tools.ietf.org/html/rfc2396
Changed January 25, 2011 11:56PM UTC by comment:5
resolution: | → fixed |
---|---|
status: | assigned → closed |
Fixes #8054 by reverting feature enhancement 5812 (4920). Regexps no longer searches for %3F in url or data to find jsonp callback placeholders.
Changeset: 325dcdc2ab05173f809b9d83af59918b3695cc23
Changed January 25, 2011 11:58PM UTC by comment:6
blocking: | → 5812 |
---|
(In #5812) This enhancement breaks legitimate uses of ? in url or data.
Changed January 28, 2011 01:07PM UTC by comment:7
milestone: | 1.next → 1.5 |
---|
For more information, my current data of this AJAX is the following code.