Home » File Formats » File_Bittorrent » Bug #8085
announce_list does not return all trackers
Details
| Submitted | 2006-06-30 08:51 UTC |
|---|---|
| From | brent dot bb at gmail dot com |
| Assigned | tacker |
| Status | Closed |
| Package | File_Bittorrent |
| PHP Version | Irrelevant |
| OS | FreeBSD 6.0-STABLE |
| Roadmaps | (Not assigned) |
Comments
[2006-06-30 08:51 UTC] brent dot bb at gmail dot com
Description:
------------
Decode.php's announce_list parser returns a single dimensional array of the first tracker in each tracker group. The announce_list should be a multidimensional array with all trackers in groups.
Test script:
---------------
<?php require_once("File/Bittorrent/Decode.php");
$File_Bittorrent_Decode = new File_Bittorrent_Decode();
/* http://www.gotwoot.net/torrents/%5BAonE-AnY%5D_Ah_My_Goddess_-_Sorezore_no_Tsubasa_-_04v2_%5BWS%5D%5BDD3442E4%5D.avi.torrent saved locally as AMG204v2.torrent */
$infob = $File_Bittorrent_Decode->decodeFile("AMG204v2.torrent");
print_r ($File_Bittorrent_Decode->announce_list); ?>
/* Patch replaces lines 253-260 of File/Bittorrent/Decode.php */
// This contains a list of all known trackers for this torrent
if (isset($decoded['announce-list']) and is_array($decoded['announce-list'])) {
$i=0;
foreach($decoded['announce-list'] as $group) {
$j=0;
foreach($group as $item){
$this->announce_list[$i][$j] = $item;
$j++;
}
$i++;
}
}
Expected result:
----------------
/* Patched code return */
Array (
[0] => Array (
[0] => http://tracker.gotwoot.net:6968/announce
)
[1] => Array (
[0] => http://www.point-blank.cc:6969/announce
[1] => http://www.point-blank.cc:7000/announce
[2] => http://www.point-blank.cc:7001/announce
)
)
/* btshowmetainfo 20030621 - decode BitTorrent metainfo files
Groups delimited by | and trackers within group delimited by ,
*/
announce-list.: http://tracker.gotwoot.net:6968/announce|http://www.point-blank.cc:6969/announce,http://www.point-blank.cc:7000/announce,http://www.point-blank.cc:7001/announce
Actual result:
--------------
/* 1.0.0 code returns this */
Array (
[0] => http://tracker.gotwoot.net:6968/announce
[1] => http://www.point-blank.cc:6969/announce
)
[2006-07-02 16:51 UTC] tacker at php dot net
This bug has been fixed in CVS.
If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
ChangeSet: http://versions.tacker.org/trac/File_Bittorrent/changeset/55