Bugfix in package name validation code on local upload

According to the docs (http://php.net/preg_match) preg_match() only returns a boolean false, when an error occurs, but not for valid searches without a result.
This change covers both cases.