Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:54:00+00:00 2026-06-10T18:54:00+00:00

Note: I’m not considering this is Drupal problem so I post it here on

  • 0

Note: I’m not considering this is Drupal problem so I post it here on SO.

We created a Drupal module that is supposed to return JSON. E.g. calling /foo/json returns the JSON. This is all fine in Chrome. However, Firefox just shows “null”.

The contents of the JSON is simply a PHP array with some information that gets populated with a loop

$someArray = array();
foreach(....) {
   $someArray[] = array("foo" => "bar", ...);
}

echo json_encode($someArray);

So far, I know that

  • it is not an encoding issue. If I only return a single element from $someArray[0]["some_key"], Chrome shows "USA" with a Content Length of 5, so I am sure that there is not a single non-ASCII character. However, Firefox shows null with a Content Length of 4.
  • doing a wget gives me the correct content with all the JSON. Since I trust wget more than the browser, I assume that it is not a Drupal/.htaccess issue.
  • The JSON is well-formed according to jsonlint.com and since the PHP function does the conversion, I assume it is really well-formed.
  • other stuff like permissions (everybody is allowed to acces the page) or encoding (sending UTF-8) doesn’t change the result.
  • This is not jQuery/cross-domain related since I just want to call the URL in the browser and want to see the JSON response.
  • On another machine with the same (Drupal) set-up, the result is the same.
  • I am able to return JSON from other directories that are not related to the Drupal setup. But since I just do a json_encode, I bypass every possible output by Drupal and since wget works I it’s not related to Drupal IMO.

updates according to comments

  • Content-type is application/json with proper encoding information. Changing it to text/html or something else doesn’t change anything. Using both header as well as the Drupal function for setting headers.
  • I am sure that the null repsonse is correct, since I inspected it with Firebug.
  • ini_set('default_charset', 'UTF-8'); doesn’t change anything since I already submit this information within the header.

Response header from Firefox with Firebug

Cache-Control   no-cache, must-revalidate, post-check=0, pre-check=0
Connection          Keep-Alive
Content-Language    en
Content-Length  4
Content-Type    application/json; charset=utf-8
Date            Mon, 03 Sep 2012 12:16:58 GMT
Etag            "1346674618"
Expires         Sun, 19 Nov 1978 05:00:00 GMT
Keep-Alive          timeout=5, max=100
Last-Modified   Mon, 03 Sep 2012 12:16:58 +0000
Server          Apache/2.2.22 (Ubuntu)
X-Powered-By    PHP/5.3.10-1ubuntu3.2

Request header

Accept          text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.7,de;q=0.3
Connection          keep-alive
Cookie          has_js=1; respimg_ratio=1; respimg=1000 //Drupal information
Host            vie.local
User-Agent          Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0

TL;DR
While Chrome shows correct (well-formed) JSON output, Firefox (and also tested in in Opera) only show null even for simplest string like "USA".

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:54:02+00:00Added an answer on June 10, 2026 at 6:54 pm

    The problem was that Firefox, somehow, was not sending the correct language to the server. I don’t know if via cookies or within the headers. Since I used language aware filtering for the output, the output was never returned.

    So disabling the language filter solved the problem. I have no idea why Firefox had issues with the language but this solved the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note, this is not a duplicate of .prop() vs .attr() ; that question refers
NOTE: This is a followup to my question here. I have a program that
Note: Already asked in this post (asked on StackOverflow) . However, the problem is
(Note: This is not a question about what is the best way with code
Note: Not sure if this is the right stack, please tell if I should
NOTE: This is an old question and the answers here no longer works (since
Note: I understand this is not strictly about development, but in the earlier threads
Note: I've read this and its not quite what I'm looking for: I have
Note the tag: VBA , not VB6, not VB.NET. This is specific to VBA
(Note: This post has been edited to show specific use case. See bottom.) I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.