Addon breaks captcha

This is my first post so apologies if this is a known problem.

I am trying to write a code hook addon. Not a design hook but an addon that hooks into the finish_payment hook in fn.cart.php. I need to trigger a function to write to the database once the payment has completed.

The problem is … as soon as I install the addon the application breaks.

These are the symptoms:[list=1]

[]The captcha disappears on every page it is used and cannot even be viewed using the captcha img url.

]The checkout process breaks due to a Oops (parsererror) message when clicking 'continue' (even for logged in users)

[*]Ajax functions are slow or faulty


These problems remain until the addon is disabled or uninstalled. I have installed both cs-cart 2.2.4 trial and 3.0.1rc3 and it happens in both. Also tested under windows with wamp and on a debian server. Same result.

I have created an addon.xml, func.php and init.php in my addon folder. The addon successfully adds a table to the database.

I have rewritten and renamed the addon several times and removed the database additions and created an empty function in func.php in order to test the most simple function … but the problem remains.

I don't have mod_security installed.

In short I can't get function hooks to work at all no matter how simple they are.

Can anyone help?


Answering my own question!

I had a blank line at the beginning of my func.php before the php tag. That caused all the problems listed above.

Hope this helps someone.