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 9268535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:50:25+00:00 2026-06-18T14:50:25+00:00

I am using PHP 5.3.15 (cli) (built: Jul 20 2012 23:10:20) on an amazon

  • 0

I am using PHP 5.3.15 (cli) (built: Jul 20 2012 23:10:20) on an amazon ec2 instance. When I make a call to json_encode() the resulting JSON randomly skips characters so that the JSON is no longer valid. This happens only some of the time even when the call is made with the exact same parameters/data. The curious thing is that it happens in different spots, random spots, with no pattern. It does not happen with the same data and the same code, and the same version of PHP on my local MAMP installation

…”updateTime”:”2012-12-21 03:24:14″,”createTime”:”2012-12-21:”21″,”updateTime”:”2012-12-25 19:33:25″,…

You can see the effect above at the 21:”21″. I don’t even know where to begin solving this problem.

I’ve rebooted and even created new virtual instances of the server.

I am in grievous need of help. Anything you could suggest would be awesome!!

  • 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-18T14:50:26+00:00Added an answer on June 18, 2026 at 2:50 pm

    you must set json encode Parameter for QUOT or another

     $json=json_encode($array,JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
    

    this is a sample of json encode that is on php.net

     <?php
       $a = array('<foo>',"'bar'",'"baz"','&blong&', "\xc3\xa9");
    
       echo "Normal: ",  json_encode($a), "\n";
       echo "Tags: ",    json_encode($a, JSON_HEX_TAG), "\n";
       echo "Apos: ",    json_encode($a, JSON_HEX_APOS), "\n";
       echo "Quot: ",    json_encode($a, JSON_HEX_QUOT), "\n";
       echo "Amp: ",     json_encode($a, JSON_HEX_AMP), "\n";
       echo "Unicode: ", json_encode($a, JSON_UNESCAPED_UNICODE), "\n";
       echo "All: ",     json_encode($a, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT |JSON_HEX_AMP | JSON_UNESCAPED_UNICODE), "\n\n";
    
       $b = array();
    
       echo "Empty array output as array: ", json_encode($b), "\n";
       echo "Empty array output as object: ", json_encode($b, JSON_FORCE_OBJECT), "\n\n";
    
       $c = array(array(1,2,3));
    
       echo "Non-associative array output as array: ", json_encode($c), "\n";
       echo "Non-associative array output as object: ", json_encode($c, JSON_FORCE_OBJECT), "\n\n";
    
        $d = array('foo' => 'bar', 'baz' => 'long');
    
       echo "Associative array always output as object: ", json_encode($d), "\n";
       echo "Associative array always output as object: ", json_encode($d, JSON_FORCE_OBJECT), "\n\n";
     ?>
    

    output:

     Normal: ["<foo>","'bar'","\"baz\"","&blong&","\u00e9"]
     Tags: ["\u003Cfoo\u003E","'bar'","\"baz\"","&blong&","\u00e9"]
     Apos: ["<foo>","\u0027bar\u0027","\"baz\"","&blong&","\u00e9"]
     Quot: ["<foo>","'bar'","\u0022baz\u0022","&blong&","\u00e9"]
     Amp: ["<foo>","'bar'","\"baz\"","\u0026blong\u0026","\u00e9"]
     Unicode: ["<foo>","'bar'","\"baz\"","&blong&","é"]
     All: ["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026","é"]
    
     Empty array output as array: []
     Empty array output as object: {}
    
     Non-associative array output as array: [[1,2,3]]
     Non-associative array output as object: {"0":{"0":1,"1":2,"2":3}}
    
     Associative array always output as object: {"foo":"bar","baz":"long"}
     Associative array always output as object: {"foo":"bar","baz":"long"}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using PHP 5 on my dedicated linux server 5.2.6 (cli) (built: May
Im using Debian testing, i have installed php-cli and when i try to execute
Okay - I'm beaten. I have a (PHP-CLI) server written using PHP's socket_* functions.
While using PHP cli in ubuntu i got apache as web server i cant
Is it possible to get input from a user using PHP CLI, then dump
I'm using php's CLI SAPI on Windows 7 and can't get any error output.
PHP 5.3.3-pl1-gentoo (cli) (built: Aug 17 2010 18:37:41) Hi all, I use a simple
I currently have a PHP CLI script using Zend Framework extensively which seems to
Is there anyway to recreate the following interface in PHP using the PHP CLI
I am looking to run 10 php CLI processes (parallel) using one shell script.

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.