{"id":5202,"date":"2017-03-30T17:40:45","date_gmt":"2017-03-30T14:40:45","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=5202"},"modified":"2017-03-30T17:40:45","modified_gmt":"2017-03-30T14:40:45","slug":"seems-to-work-if-i-make-it-skip-carriage-returns-in-json-php","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2017\/03\/30\/seems-to-work-if-i-make-it-skip-carriage-returns-in-json-php\/","title":{"rendered":"Seems to work if I make it skip carriage returns in Json.php"},"content":{"rendered":"<p>I make no guarantees this doesn&#8217;t break something else, but for me it seems to work correctly if I make Feediron_Json::format() skip carriage returns:<\/p>\n<pre><code>$ git diff\r\ndiff --git a\/Json.php b\/Json.php\r\nindex c988962..fc7f554 100644\r\n--- a\/Json.php\r\n+++ b\/Json.php\r\n@@ -8,6 +8,7 @@ class Feediron_Json{\r\n                $strLen      = strlen($json);\r\n                $indentStr   = '    ';\r\n                $newLine     = \"\\n\";\r\n+               $cReturn     = \"\\r\";\r\n                $prevChar    = '';\r\n                $outOfQuotes = true;\r\n                $currentline = 0;\r\n@@ -30,6 +31,9 @@ class Feediron_Json{\r\n                                $currentline++;\r\n                                continue;\r\n                        }\r\n+                       if($char == $cReturn){\r\n+                               continue;\r\n+                       }\r\n                        if($char == ' ' &amp;&amp; $outOfQuotes){\r\n                                continue;\r\n                        }<\/code><\/pre>\n<p>(Using PHP 5.6.30 here.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I make no guarantees this doesn&#8217;t break something else, but it seems to work correctly if Feediron_Json::format() skips carriage returns.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8860],"tags":[],"class_list":["post-5202","post","type-post","status-publish","format-standard","hentry","category-vianhallintajarjestelmat","sijainti-github"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=5202"}],"version-history":[{"count":2,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5202\/revisions"}],"predecessor-version":[{"id":5204,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/5202\/revisions\/5204"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=5202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=5202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=5202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}