Skip to content

Commit b984067

Browse files
committed
check version
1 parent 5bf3aba commit b984067

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<active>yes</active>
1212
</lead>
1313
<date>2013-03-08</date>
14-
<time>17:12:32</time>
14+
<time>18:06:59</time>
1515
<version>
1616
<release>1.2.3</release>
1717
<api>1.2.3</api>

src/PEARX/Channel.php

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ public function fetchPackageReleaseXml($packageName, $version = 'stable')
9797
// get version info
9898
$version = file_get_contents($url . '/' . $version . '.txt' );
9999
}
100+
101+
if( ! $version ) {
102+
throw new Exception("Invalid version: $version");
103+
}
104+
100105
$url = $url . '/' . $version . '.xml';
101106
$xmlStr = $this->core->request($url);
102107

tests/PEARX/ChannelTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ public function testPackageReleaseInfoFinderWithLatest()
1010

1111
$xml = $channel->fetchPackageReleaseXml('apc','latest');
1212
ok($xml);
13+
14+
$xml = $channel->fetchPackageReleaseXml('xdebug','2.2.1');
15+
ok($xml);
1316
}
1417

1518
public function testPackageFindPearWithFileSystemCache()

0 commit comments

Comments
 (0)