Renderer format 'json' is not valid? (why do i see this after upgrading?)


i had some fatal errors during the recent upgrade. now though, after some tips in github, i have piwik working again.
mostly it appears fine, however, i just activated some code i recently wrote that uses piwik to identify the geo_ip details of site visitors and then displays different content to them based on their continent. whereas before the upgrade this worked fine, now i am seeing fatal PHP errors for this call. i already found one thread in the forum here related to the first error i was getting and have applied the recommended workaround to my API call to piwik:

// Workaround for 2.14.0 bug
$environment = new \Piwik\Application\Environment(‘tracker’);

the error i am now seeing appears to come after i have successfully retrieved the data from the API call:

renderer format ‘json’ not valid. try any of the following instead .

there are no render formats being recommended by this error code and in any case the data has been returned successfully anyway.
i changed the format to XML just to see if that made any difference, but it didn’t - i still saw the same error (except with the word json replaced with XML).

anyone know what’s going on here?



so i started debugging this in piwik and found that ‘public static function factory’ in APIrenderer is being run twice when i load the page in the browser. the first time, the correct list of renderer format classes is retrieved and is available. the second time, however, the returned array of formats is empty and thus my code fails.

i don’t know enough about how piwik is designed to comment on this much… except to say that i wonder if the workaround for the 2.14.0 bug that i found is not really such a great workaround:

// Workaround for 2.14.0 bug
$environment = new \Piwik\Application\Environment('tracker');


I also tried to use the workaround for WP-Piwik, but I also run into the “render format not valid” issue. (It does not matter which render format I choose.)

Currently all WP-Piwik installations using the PHP API are broken. :frowning:


ok yes, i figured this would be quite a major glitch in terms of reach and effect! any comment from piwik devs on this?