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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:46:13+00:00 2026-05-15T10:46:13+00:00

I’ve an issue with my JSON. It works returns correctly in PHP 5.3 (so

  • 0

I’ve an issue with my JSON. It works returns correctly in PHP 5.3 (so I can’t use json_last_error()), and it returns successfully when I copy string explicitly into json_decode (json_decode(‘{…}’). It only returns null in when I pass the result as a variable and I’m using php 5.2, which is what I need it for.

The output comes from JSON logging in PHPUnit:

[
    {
        "event": "suiteStart",
        "suite": "",
        "tests": 2
    },
    {
        "event": "suiteStart",
        "suite": "TagTestCase",
        "tests": 2
    },
    {
        "event": "test",
        "suite": "TagTestCase",
        "test": "TagTestCase::test_it",
        "status": "fail",
        "time": 0.00248718261719,
        "trace": [
            {
                "file": "\/UnitTest\/PHPUnit.php",
                "line": 98,
                "function": "run",
                "class": "PHPUnit_Framework_TestSuite",
                "type": "->",
                "args": [
                    {

                    }
                ]
            },
            {
                "file": "\/UnitTest\/PHPUnit.php",
                "line": 116,
                "function": "run",
                "class": "PHPUnit",
                "type": "->",
                "args": [

                ]
            },
            {
                "file": "\/UnitTest\/PHPUnit.php",
                "line": 212,
                "function": "__tostring",
                "class": "PHPUnit",
                "type": "->",
                "args": [

                ]
            }
        ],
        "message": "false assertionzzzzz.\nFailed asserting that <boolean:false> is true."
    },
    {
        "event": "test",
        "suite": "TagTestCase",
        "test": "TagTestCase::test_two",
        "status": "pass",
        "time": 0.00182914733887,
        "trace": [

        ],
        "message": ""
    }
]

EDIT: These are the paths, I’ve been exploring – maybe you are a better explorer..
Three possible paths that could help:

  • What is different about json_decode() in php 5.2 then 5.3? what did they change?
  • Someone else using JSON from PHPUnit, and how they parse it.
  • What changes when you have it in a variable vs. printing it to screen and copying it into json_decode()

Any help would be greatly(!) appreciated.

Thanks!
Matt

  • 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-15T10:46:13+00:00Added an answer on May 15, 2026 at 10:46 am

    What a HORRENDOUS debug session.. well there’s good news.. I figured it out..

    I started looking at it using AJAX and logging it with Firebug… and it turns out json_decode (or eval by the way) cannot handle &quot;, which is what PHPUnit sends back (Come on Sebastian!), so to fix it:

    $json = str_replace('&quot;', '"', $json);
    

    Now I thought they were the same.. maybe someone can enlighten me..

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

Sidebar

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.