syncronise 4.5 api behaviour with 4.4 to provide more consistent extensi...

...on support

This is just a backport of 
https://github.com/civicrm/civicrm-core/commit/23474ab300e2325d19608a958305f7186fcf0a16

so that extension writers get more consistent api behaviour across CiviCRM versions