BUG 8973 "Replace all instances of json_encode() and json_decode()..." SOLVED

- Problems with functions json_encode and json_decode in PHP 5.2
- Replace json_encode and json_decode with G::json_encode and G::json_decode
This commit is contained in:
Victor Saisa Lopez
2012-04-23 12:34:16 -04:00
parent b623e8577b
commit 9df68b5307
8 changed files with 22 additions and 22 deletions

View File

@@ -27,7 +27,7 @@ try {
list($userNum, $user) = userGet($limit, $start);
//echo "{success: " . true . ", resultTotal: " . count($user) . ", resultRoot: " . G::json_encode($user) . "}";
echo json_encode(array("success" => true, "resultTotal" => $userNum, "resultRoot" => $user));
echo G::json_encode(array("success" => true, "resultTotal" => $userNum, "resultRoot" => $user));
break;
}
} catch (Exception $e) {

View File

@@ -19,7 +19,7 @@ try {
}
//echo "{success: " . true . ", resultTotal: " . count($aResult) . ", resultRoot: " . G::json_encode($aResult) . "}";
echo json_encode(array("success" => true, "resultTotal" => count($aResult), "resultRoot" => $aResult));
echo G::json_encode(array("success" => true, "resultTotal" => count($aResult), "resultRoot" => $aResult));
} catch (Exception $e) {
echo null;
}

View File

@@ -47,7 +47,7 @@ function cancelCheckout($alfrescoServerUrl, $docUid, $user="", $pwd="") {
$alfresco_url = "$alfrescoServerUrl/s/cmis/pwc/s/workspace:SpacesStore/i/$docUid";
$domapi_exec = RestClient::delete($alfresco_url,$user,$pwd,"application/atom+xml;type=entry");
//$alfrescoMessage = $domapi_exec['header'];
$domapi_res = json_decode($domapi_exec->getResponse());
$domapi_res = G::json_decode($domapi_exec->getResponse());
return $domapi_res;
}
@@ -169,7 +169,7 @@ function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) {
$alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId";
$alfresco_exec = RestClient::delete($alfresco_url,$user,$pwd,"application/atom+xml");
$alfresco_res = json_decode($alfresco_exec->getResponse());
$alfresco_res = G::json_decode($alfresco_exec->getResponse());
echo($alfresco_res);
return $alfresco_res;
}
@@ -195,7 +195,7 @@ function deleteObject($alfrescoServerUrl, $objetcId, $user, $pwd) {
function downloadDoc($alfrescoServerUrl, $parentFolder, $folderName, $user, $pwd) {
$alfresco_url = "$alfrescoServerUrl/s/cmis/s/workspace:SpacesStore/i/$objetcId";
$alfresco_exec = RestClient::delete($alfresco,$user,$pwd,"application/atom+xml");
$alfresco_res = json_decode($alfresco_exec->getResponse());
$alfresco_res = G::json_decode($alfresco_exec->getResponse());
echo($alfresco_res);
return $alfresco_res;
}
@@ -219,10 +219,10 @@ function getCheckedoutFiles($alfrescoServerUrl, $user, $pwd) {
$getChildrenUrl = "$alfrescoServerUrl/s/cmis/checkedout";
$domapi_exec = RestClient::get($getChildrenUrl,$user,$pwd,'application/atom+xml');
$sXmlArray = json_decode($domapi_exec->getResponse());
$sXmlArray = G::json_decode($domapi_exec->getResponse());
$sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @json_decode(@json_encode($xXmlArray),1);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1);
var_dump($aXmlArray);
return $alfresco_res;
@@ -250,7 +250,7 @@ function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) {
$sXmlArray = $alfresco_exec->getResponse();
$sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @json_decode(@json_encode($xXmlArray),1);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1);
//var_dump($aXmlArray);
var_dump($aXmlArray);
@@ -290,7 +290,7 @@ function uploadDoc($alfrescoServerUrl, $fileSource, $title, $description, $docTy
$sXmlArray = $alfresco_exec->getResponse();
$sXmlArray = trim($sXmlArray);
$xXmlArray = simplexml_load_string($sXmlArray);
$aXmlArray = @json_decode(@json_encode($xXmlArray),1);
$aXmlArray = @G::json_decode(@G::json_encode($xXmlArray),1);
var_dump($aXmlArray);
return $aXmlArray;
}

View File

@@ -311,7 +311,7 @@ function getDWSDocumentVersions($sharepointServer, $auth, $newFileName, $dwsname
*/
$xml = $result->GetVersionsResult->any;// in Result we get string in Xml format
$xmlNew = simplexml_load_string($xml);// used to parse string to xml
$xmlArray = @json_decode(@json_encode($xmlNew),1);// used to convert Objects to array
$xmlArray = @G::json_decode(@G::json_encode($xmlNew),1);// used to convert Objects to array
$resultCount = count($xmlArray['result']);
for($i=0;$i<$resultCount;$i++)
{

View File

@@ -109,7 +109,7 @@ class pmTrSharepointClass{
$result = $this->dwsObj->callWsMethod($methodName, $paramArray);
$xml = $result->CreateDwsResult; // in Result we get string in Xml format
$xmlNew = simplexml_load_string($xml); // used to parse string to xml
$xmlArray = @json_decode(@json_encode($xmlNew), 1); // used to convert Objects to array
$xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$dwsUrl = $xmlArray['Url'];
return "Dws with following Url is created:$dwsUrl";
@@ -200,7 +200,7 @@ class pmTrSharepointClass{
var_dump($result);
$sResult = $result->GetDwsDataResult;
/* $xmlNew = simplexml_load_string($sResult);// used to parse string to xml
$xmlArray = @json_decode(@json_encode($xmlNew),1);// used to convert Objects to array */
$xmlArray = @G::json_decode(@G::json_encode($xmlNew),1);// used to convert Objects to array */
$serializeResult = serialize($sResult); // serializing the Array for Returning.
var_dump($serializeResult);
return $serializeResult;
@@ -301,7 +301,7 @@ class pmTrSharepointClass{
if ($result) {
$sResult = $result->DeleteVersionResult->any;
$xmlNew = simplexml_load_string($sResult); // used to parse string to xml
$xmlArray = @json_decode(@json_encode($xmlNew), 1); // used to convert Objects to array
$xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$versionCount = count($xmlArray['result']);
if($versionCount>1)
@@ -338,7 +338,7 @@ class pmTrSharepointClass{
if ($result) {
$xml = $result->DeleteAllVersionsResult->any; // in Result we get string in Xml format
$xmlNew = simplexml_load_string($xml); // used to parse string to xml
$xmlArray = @json_decode(@json_encode($xmlNew), 1); // used to convert Objects to array
$xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1); // used to convert Objects to array
$latestVersion = $xmlArray['result']['@attributes']['version'];
return "All Versions are Deleted, except the latest i.e $latestVersion";
} else {

View File

@@ -52,7 +52,7 @@ function getZimbraFolder($ServerUrl, $username, $preAuthKey, $folderName) {
$aXmlArray = array();
$aXmlArray = $zimbra->getFolder($folderName);
$sXmlArray = @json_decode(@json_encode($aXmlArray), 1);
$sXmlArray = @G::json_decode(@G::json_encode($aXmlArray), 1);
$serializeResult = serialize($sXmlArray); // serializing the Array for Returning.
return $serializeResult;
@@ -84,7 +84,7 @@ function getZimbraContactList($ServerUrl, $username, $preAuthKey) {
$sXmlArray = array();
$sXmlArray = $zimbra->getContacts();
$aXmlArray = @json_decode(@json_encode($sXmlArray), 1);
$aXmlArray = @G::json_decode(@G::json_encode($sXmlArray), 1);
$serializeResult = serialize($aXmlArray); // serializing the Array for Returning.
return $serializeResult;
@@ -119,7 +119,7 @@ function getZimbraTaskList($ServerUrl, $username, $preAuthKey) {
$sXmlArray = array();
$sXmlArray = $zimbra->getTasks();
$aXmlArray = @json_decode(@json_encode($sXmlArray), 1);
$aXmlArray = @G::json_decode(@G::json_encode($sXmlArray), 1);
$serializeResult = serialize($aXmlArray); // serializing the Array for Returning.
return $serializeResult;
@@ -154,7 +154,7 @@ function getZimbraAppointmentList($ServerUrl, $username, $preAuthKey) {
$sXmlArray = array();
$sXmlArray = $zimbra->getAppointments();
$aXmlArray = @json_decode(@json_encode($sXmlArray), 1);
$aXmlArray = @G::json_decode(@G::json_encode($sXmlArray), 1);
$serializeResult = serialize($aXmlArray); // serializing the Array for Returning.
return $serializeResult;

View File

@@ -107,7 +107,7 @@ class adminProxy extends HttpProxyController
function uxUserUpdate($httpData)
{
require_once 'classes/model/Users.php';
$data = json_decode($httpData->users);
$data = G::json_decode($httpData->users);
$list = array();
if (!is_array($data)) {
@@ -145,7 +145,7 @@ class adminProxy extends HttpProxyController
function uxGroupUpdate($httpData)
{
require_once 'classes/model/Groupwf.php';
$data = (array) json_decode($httpData->groups);
$data = (array) G::json_decode($httpData->groups);
$group = GroupwfPeer::retrieveByPK($data['GRP_UID']);
$group->setGrpUx($data['GRP_UX']);
@@ -715,7 +715,7 @@ class adminProxy extends HttpProxyController
}
}
$o = array('images' => $images);
echo json_encode($o);
echo G::json_encode($o);
exit();
}
/**

View File

@@ -83,7 +83,7 @@ function getExtJSParams() {
function sendJsonResultGeneric($response, $callback) {
header("Content-Type: application/json");
$finalResponse = json_encode($response);
$finalResponse = G::json_encode($response);
if ($callback != '') {
print $callback . "($finalResponse);";
} else {