Joomla 3 error 500 on contact form serialization of XML

Written by Peter Davies on .

Joomla 3.x Recaptcha validation fail with message:
Error: 500 "Serialization of 'SimpleXMLElement' is not allowed"

Edit using nano the file:

libraries/cms/form/rule/captcha.php

On line 48 we have:

$captcha = JCaptcha::getInstance($plugin, array('namespace' => $namespace));

You need to cast the result as a string value like so:

$captcha = JCaptcha::getInstance($plugin, array('namespace' => (string) $namespace));

This is reference to the bug in Joomla:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=29570

This is only a pre-Joomla 3.01 issue, after making this manual modification we actually just updated Joomla to the latest stable version via the standard update tool.