Error after saving a custom block (add or edit)

Permalink
After saving a custom block an Error dialog is displayed (title is just Error, no more).
The content of the error is:
array ( 'ccm-block-form-method' => 'AJAX', 'sku' => 'P002', 'yarn' => '', 'model' => '', 'needles' => '', 'gauge' => '', 'finishedSize' => '', 'notions' => '', 'wholesale' => '3', 'retail' => '6', 'ravelryLink' => '', 'description' => 'Pattern 2', 'thanks' => '', 'testimonials' => '', 'images' => '', 'beads' => '', 'crochetHooks' => '', 'available' => 0, 'patternfishId' => '', 'isCharted' => 0, 'isWritten' => 0, 'difficulty' => '', 'skills' => '', 'bustSize' => '', '_add' => '1', 'processBlock' => '1', 'ccm-add-block-submit' => 'submit', 'uID' => '2', ){"aID":"166","arHandle":"Main","cID":"155","error":false,"bID":"154"}


Curiously enough, the data is saved correctly.
This appears to happen after parent::save() returns.
TIA,
Dave

 
dpatterson replied on at Permalink Reply
Okay.
I've gathered a bit more information.
The contents of the Error dialog appears to be an AJAX response, presumably for the Save operation.

The dialog is displayed by the JavaScript line
ccmAlert.notice(ccmi18n.error, r);
in function ccm_parseBlockResponse() in ccm.app.js (line 5760 in the unuglified version of the file).

The error is the result of
resp = eval('(' + r + ')');
failing.

I don't currently have a clue why the Save operation is returning invalid JSON.

Help would be appreciated.
Thanks in advance.
dpatterson replied on at Permalink Reply
[Solved]

This was being caused by soem extraneous output to the browser.
My fault. :-(

I was missing the second parameter in a call to var_export(). That caused var_export to dump the text to the output buffer which corrupted the AJAX return value.

Maybe this will help someone else down the road.
dpatterson replied on at Permalink Reply
Oh yeah. One other thing.
Thanks to the aghouseh and hereNT_work on IRC for the assist.
While not the actual answer, they helped me find stuff
and also helped me eliminate some things.

Thanks again