PHP SDK: Fatal error: Call to undefined function json_encode()

Hi,
Using PHP SDK I’m getting the following error:

Fatal error: Call to undefined function backendless\lib\json_encode() in backendless/src/lib/RequestBuilder.php on line 66

I’ve tried prefixing it with a \ to fallback the default function considering that maybe the namespace thing is causing this issue; it didn’t help.

I’m sure that json_encode is working, it’s used in several other functions of my server code.

And it’s just a basic save operation using the default Contact example from the documentation.

Thanks,

~ Fatih

Hello Fatih

Please provide us with your code sample which reproduces the issue.

Regards Anton

Here’s my code:


<?php


header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: 0"); // Proxies




require_once (kpPATH_TO_LIBS . "/Backendless/backendless/autoload.php");


use backendless\Backendless;


Backendless::initApp( kpBACKENDLESS_REST_SECRET, kpBACKENDLESS_API_KEY, kpBACKENDLESS_APP_VERSION );




$attendee = new kpAttendee();


$attendee->Title = "Dr.";
$attendee->NameFirst = "Fatih";
$attendee->NameLast = "Demir";
$attendee->Photo = NULL;
$attendee->SearchTokens = "dr,fatih,demir";


$result = Backendless::$Persistence->save( $attendee );


var_dump( $result );


?>

Hi Anton,

I’ve moved my code to another server.
It doesn’t throw this error anymore, rather another one.
I’m gonna open a new thread for that, please don’t spend time for this question unless of course you already have the answer.

Thanks,

No problem, waiting for another thread. Closing this one