title: Bug report ExtJS 7.4.0 Ext.data.reader.Json
body: <p>first post on this account, how exciting. Sadly, the contents are less exciting. I have found a very simple bug in the <code>reader.json</code> function <code>getResponseData</code>.</p>
  <p>I want to have proper error handling in my application should, unexpectedly, the server I'm querying not provide me with valid JSON. The reader has an exception event for exactly this problem. However, <code>reader.json</code> sets <code>responseType</code> on the XHR to <code>&quot;json&quot;</code>.</p>
  <p>And as detailed <a href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType" rel="nofollow noreferrer">here</a>, this results in a <code>null</code> value in <code>response.response</code> on the XHR:</p>
  <blockquote>
  <p>When setting responseType to a particular value, the author should make sure that the server is actually sending a response compatible with that format. If the server returns data that is not compatible with the responseType that was set, the value of response will be null.</p>
  </blockquote>
  <p><code>getResponseData</code> wants to avoid work, and so will return <code>responseJson</code>, if this is an object:</p>
  <pre><code>if (typeof response.responseJson === 'object') {
      return response.responseJson;
  }
  </code></pre>
  <p>However, in the version of Chrome I'm using <code>typeof null</code> evaluates to <code>&quot;object&quot;</code>.</p>
  <p>I fixed this in my application by overriding the function and replacing the first line above with <code>if (Ext.isObject(response.responseJson)) {</code>, but I think this should be fixed in the framework code.</p>
  <p>I'm not really looking for an answer, but some kind of reaction for sencha would be nice.</p>
  <p>This is posted here, because I skimmed over <a href="https://stackoverflow.blog/2019/10/30/why-sencha-is-moving-its-support-forums-to-stack-overflow/">https://stackoverflow.blog/2019/10/30/why-sencha-is-moving-its-support-forums-to-stack-overflow/</a></p>
  <p>Version information</p>
  <ul>
  <li>ExtJS release version 7.4.0</li>
  <li>Google Chrome Version 92.0.4515.131 (64-Bit)</li>
  </ul>
  <p>EDIT:
  It appears my text was not explicit enough about my problem, so I'll add an example here. I have a store that looks similar to this:</p>
  <pre><code>Ext.define('myCoolStore', {
      extend: 'Ext.data.Store',
      
      constructor: function(cfg) {
          var me = this;
          cfg = cfg || {};
          me.callParent([Ext.Object.merge({
              proxy: {
                  type: 'ajax',
                  withCredentials: true,
                  reader: {
                      type: 'json',
                      rootProperty: 'results'
                  },
                  listeners: {
                      exception: {
                          fn: me.onAjaxException,
                          scope: me
                      }
                  }
              }
          }, cfg)]);
      },
  
      onAjaxException: function(proxy, response, operation, eOpts) {
          // ..
      }
  });
  </code></pre>
  <p>Now, if I do <code>myCoolStore.load()</code>, I expect a server response like this:</p>
  <pre><code>{
      &quot;success&quot;: true,
      &quot;deprecated&quot;: false,
      &quot;results&quot;: [{
          &quot;id&quot;: &quot;11730&quot;,
          &quot;bericht_id&quot;: &quot;167&quot;,
          &quot;projekt_id&quot;: &quot;1429&quot;,
          &quot;lastedit&quot;: &quot;2021-08-10 16:01:20&quot;,
          &quot;lastedit_mitarbeiter_id&quot;: &quot;182&quot;
      }],
      &quot;errors&quot;: [],
      &quot;messages&quot;: [],
      &quot;total&quot;: 1,
      &quot;metaData&quot;: null
  }
  </code></pre>
  <p>However, the server might be bugged and return something else, that is invalid JSON. For the sake of simplicity, let's say someone forgot to turn of display_errors in his PHP ini, and the answer looks like this</p>
  <pre><code>[..date..] [php7:notice] [pid ..pid..] [client ..ip..] PHP Notice:  Trying to get property 'myCoolProperty' of non-object in file.class.php on line 80, referer: ..myCoolSite..
  {
      &quot;success&quot;: true,
      &quot;deprecated&quot;: false,
      &quot;results&quot;: [{
          &quot;id&quot;: &quot;11730&quot;,
          &quot;bericht_id&quot;: &quot;167&quot;,
          &quot;projekt_id&quot;: &quot;1429&quot;,
          &quot;lastedit&quot;: &quot;2021-08-10 16:01:20&quot;,
          &quot;lastedit_mitarbeiter_id&quot;: &quot;182&quot;
      }],
      &quot;errors&quot;: [],
      &quot;messages&quot;: [],
      &quot;total&quot;: 1,
      &quot;metaData&quot;: null
  }
  </code></pre>
  <p>The default behaviour of the <code>reader.json</code> will not set an exception here, because the XHR will not be able to parse this, resulting in <code>reponseJson</code> being <code>null</code>, which will pass the <code>typeof</code>-check.</p>