Skip to content

Commit d2a9379

Browse files
author
Joseph Lenton
committed
minor IE9 bugfix
IE 9 returns a header as an empty string, if not found. Other browsers returned null. Before it was checking for null, now it checks for an empty string too.
1 parent 7612853 commit d2a9379

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/php_error.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,9 +2989,12 @@ private function displayJSInjection() {
29892989
* Check headers for error.
29902990
*/
29912991
if ( ! isAjaxError && state >= 2 ) {
2992+
/*
2993+
* It's null in some browsers, and an empty string in others.
2994+
*/
29922995
var header = inner.getResponseHeader( '<?php echo ErrorHandler::PHP_ERROR_MAGIC_HEADER_KEY ?>' );
29932996

2994-
if ( header !== null ) {
2997+
if ( header !== null && header !== '' ) {
29952998
self.__.isAjaxError = true;
29962999
isAjaxError = true;
29973000
}
@@ -3050,14 +3053,18 @@ private function displayJSInjection() {
30503053
errorOnce
30513054
) {
30523055
errorOnce = false;
3056+
if ( window.console && window.console.log ) {
3057+
window.console.log( 'Ajax Error Calling: ' + self.__.url );
3058+
}
3059+
30533060
runFail.call( self, ev );
30543061
}
30553062
};
30563063

30573064
copyRequestProperties( inner, this, true );
30583065

30593066
/*
3060-
* Private fields are stored underneath an unhappy face,
3067+
* Private fields are stored underneath the unhappy face,
30613068
* to localize them.
30623069
*
30633070
* Access becomes:
@@ -3067,7 +3074,8 @@ private function displayJSInjection() {
30673074
methodCalls: [],
30683075
inner: inner,
30693076
isAjaxError: false,
3070-
isSynchronous: false
3077+
isSynchronous: false,
3078+
url: ''
30713079
};
30723080
}
30733081

@@ -3093,8 +3101,11 @@ private function displayJSInjection() {
30933101
args: args
30943102
});
30953103
}
3104+
var grabOpen = function( args, method ) {
3105+
this.__.url = args[1];
3106+
}
30963107

3097-
wrapMethod( XMLHttpRequest, old, 'open' , saveRequest, copyIn, isSynchronous );
3108+
wrapMethod( XMLHttpRequest, old, 'open' , saveRequest, copyIn, isSynchronous, grabOpen );
30983109
wrapMethod( XMLHttpRequest, old, 'abort' , saveRequest, copyIn );
30993110
wrapMethod( XMLHttpRequest, old, 'send' , saveRequest, copyIn, addHeader );
31003111
wrapMethod( XMLHttpRequest, old, 'sendAsBinary', saveRequest, copyIn, addHeader );

0 commit comments

Comments
 (0)