All of the wiki API documentation describes testing the result of all API calls with civicirm_error($result) . However this resides in api/v2/utils.php . None of the v1 APIs include this file, most notably UFGroup.php . So you get a Call to undefined function civicrm_error() fatal error.
My thought is that all API files should require_once('api/v2/utils.php');