[#34040] Fixed PHP Warning

PHP Warning:  Invalid argument supplied for foreach() in libraries/joomla/string/string.php on line 970

In addition, under no circumstance the function was able to return null.
I've updated the function to reflect its description and return false in case of badly formed URL.

http://code.joomla.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=34040&start=0