1
0
Fork 0

Remove dependency on filter_var

pull/151/merge
Jordi Boggiano 2012-03-05 15:13:07 +01:00
parent 639e6ba487
commit 774e9d0da6
4 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
* 1.0.0-alpha2 * 1.0.0-alpha2
* Added "file" downloader type to download plain files * Added "file" downloader type to download plain files
* Dependency on filter_var is now optional
* 1.0.0-alpha1 (2012-03-01) * 1.0.0-alpha1 (2012-03-01)

View File

@ -34,7 +34,7 @@ class InitCommand extends Command
public function parseAuthorString($author) public function parseAuthorString($author)
{ {
if (preg_match('/^(?P<name>[- \.,a-z0-9]+) <(?P<email>.+?)>$/i', $author, $match)) { if (preg_match('/^(?P<name>[- \.,a-z0-9]+) <(?P<email>.+?)>$/i', $author, $match)) {
if ($match['email'] === filter_var($match['email'], FILTER_VALIDATE_EMAIL)) { if (!function_exists('filter_var') || $match['email'] === filter_var($match['email'], FILTER_VALIDATE_EMAIL)) {
return array( return array(
'name' => trim($match['name']), 'name' => trim($match['name']),
'email' => $match['email'] 'email' => $match['email']

View File

@ -31,7 +31,7 @@ class ComposerRepository extends ArrayRepository
$config['url'] = 'http://'.$config['url']; $config['url'] = 'http://'.$config['url'];
} }
$config['url'] = rtrim($config['url'], '/'); $config['url'] = rtrim($config['url'], '/');
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) { if (function_exists('filter_var') && !filter_var($config['url'], FILTER_VALIDATE_URL)) {
throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$config['url']); throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$config['url']);
} }

View File

@ -31,7 +31,7 @@ class PearRepository extends ArrayRepository
$config['url'] = 'http://'.$config['url']; $config['url'] = 'http://'.$config['url'];
} }
if (!filter_var($config['url'], FILTER_VALIDATE_URL)) { if (function_exists('filter_var') && !filter_var($config['url'], FILTER_VALIDATE_URL)) {
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']); throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$config['url']);
} }