Fixed Double JSON Encoding

- Updated PPModel to not double encode urls in Json String.
This commit is contained in:
japatel
2014-10-24 14:59:00 -05:00
parent 26726e68c4
commit f55fd3d984
3 changed files with 6 additions and 3 deletions

View File

@@ -218,7 +218,10 @@ class PPModel
*/
public function toJSON($options = 0)
{
return json_encode($this->toArray(), $options);
// Because of PHP Version 5.3, we cannot use JSON_UNESCAPED_SLASHES option
// Instead we would use the str_replace command for now.
// TODO: Replace this code with return json_encode($this->toArray(), $options | 64); once we support PHP >= 5.4
return str_replace('\\/', '/', json_encode($this->toArray(), $options));
}
/**

View File

@@ -18,7 +18,7 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com"}'));
return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com"}';
}
/**

View File

@@ -22,7 +22,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"id":"TestSample","name":"TestSample","flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}'));
return '{"id":"TestSample","name":"TestSample","flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}';
}
/**