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

  • SEARCH
  • Home
  • 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 6900011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:29:37+00:00 2026-05-27T07:29:37+00:00

Sometime recently my WordPress plugin started failing in my DEV environment (on two different

  • 0

Sometime recently my WordPress plugin started failing in my DEV environment (on two different boxes) on an AJAX call. What I see is that when I call:

$t = json_encode(<some array>);

an extraneous + character is inserted into the output buffer. I observed this by viewing the result of an ob_get_content() call. $t shows the correct JSON results, and the contents of <some array> doesn’t seem to matter.

I determined it’s not a PHP issue in and of itself, as it only seems to occur within the context of WordPress.

I isolated it to the following function in my plugin:

function my_action_callback() {
    $a = array("a" => "orange", "b" => "banana", "c" => "apple");
    echo json_encode($a);
    die(); // this is required to return a proper result
}

my_action_callback is a callback function registered to be called by WordPress on an AJAX call. I can assign the results of json_encode to a variable instead of echoing, and the results are fine, but checking the output buffer at that point shows a single + already inserted.

Unfortunately, I am not sure what change I made in my environment started this behavior, since I waited too long to debug this. I’m not sure where to start now.

The environment is PHP 5.3.5 running WordPress 3.2.1

Why would calling json_encode put ANYTHING in the output buffer, since I am not echoing the results?

  • 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-05-27T07:29:37+00:00Added an answer on May 27, 2026 at 7:29 am

    Start with a clean PHP env, write and see if it prints the +. If it does, it’s a PHP bug.

    Get rid of the code above, put in your code and see if it prints the +. If it does, it’s a bug in your code.

    Start re-doing you modifications to the PHP env. Test, after each change, it it prints the +. When it does, you’ve found the culprit.

    If, at the end, you still can’t see the +, then it’s magic. 😉

    Take home lesson: never let bugs linger around for too long.

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

Sidebar

Related Questions

Sometime I see many application such as msn, windows media player etc that are
I have recently started using coffeescript with Rails and I am finding that sometimes
I have been working with relational databases for sometime, but it only recently occurred
I was recently working on a windows program that would sometimes become unresponsive when
I've been a web developer for some time now, and have recently started learning
Sometime when looking through code, I see many methods specify an annotation: @SuppressWarnings(unchecked) What
I recently learned that sometimes people will lock specific processes or threads to specific
I recently turned an old Joomla site into a Wordpress site and I want
I am recently experiencing some very strange behavious with Fash Builder 4.5. Sometime it
Recently we deployed one struts application into production, after sometime if we try to

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.