Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1
-
Fix Version/s: 3.2.4
-
Component/s: CiviCRM API
-
Labels:None
Description
In civicrm_tag_create():
$tagBAO = CRM_Core_BAO_Tag::add($params, $ids);
if ( is_a( $tagBAO, 'CRM_Core_Error' ) )
{ return civicrm_create_error( "Tag is not created" ); } else {
$values = array( );
_civicrm_object_to_array($tagBAO, $values);
This code does not consider the possibility of $tagBAO being NULL / not an object,
although NULL is clearly a possible return value, as can be seen in CRM_Core_BAO_Tag::add().
Should be easy to fix, unless we want to do bikeshedding...
This happens if $params['name'] is missing. It would make sense to show a useful error message, like this:
if ( !is_object($tagBAO) )
{ return civicrm_create_error( "civicrm_tag_create() - one parameter was missing, probably 'name'." ); } else if ( is_a( $tagBAO, 'CRM_Core_Error' ) ) {
...