Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.0

Bug #7406 MakeTorrent wont add files in directories
Submitted: 2006-04-15 23:41 UTC
From: knightar at gmail dot com Assigned: tacker
Status: Closed Package: File_Bittorrent (version 1.0.0)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 4 + 7 = ?

 
 [2006-04-15 23:41 UTC] knightar at gmail dot com (KnightAR)
Description: ------------ MakeTorrent wont make a torrent of all the files in a dir like the docs said it would. It comes up with no result when using a directory. I currently have the following files in "D:/files_to_torrent/": atvp4.exe readme.txt website.lnk The same method works when adding "D:/files_to_torrent/atvp4.exe" insted. Also, I used the php.ini-dist origional file and added include_path=".;C:\PHP\pear" to it. Test script: --------------- error_reporting(E_ALL); require_once 'File/Bittorrent/MakeTorrent.php'; // Set error handling PEAR::setErrorHandling(PEAR_ERROR_PRINT); $MakeTorrent = new File_Bittorrent_MakeTorrent('D:/files_to_torrent/'); // Set the announce URL $MakeTorrent->setAnnounce('http://www.example.org'); // Set the comment $MakeTorrent->setComment('Hello World!'); // Set the piece length (in KB) $MakeTorrent->setPieceLength(256); // Build the torrent $metainfo = $MakeTorrent->buildTorrent(); echo $metainfo;

Comments

 [2006-04-16 03:06 UTC] knightar at gmail dot com
I've got a quick patch after alot of debugging and ripping apart the coding. Bascily, the _addDir function was not returning anything after it was completed. I'm guessing that the function wasnt returning $this->files after the function was finished. diff -u MakeTorrent_bk.php MakeTorrent.php --- MakeTorrent_bk.php 2006-04-15 16:04:03.546875000 -0700 +++ MakeTorrent.php 2006-04-15 19:50:26.578125000 -0700 @@ -398,6 +398,7 @@ $this->_files[] = $filedata; } } + return true; } /**
 [2006-04-16 03:12 UTC] knightar at gmail dot com
- OS version - PHP Version + PHP Version: Irrelevant
 [2006-04-16 09:52 UTC] tacker at php dot net (Markus Tacker)
 [2006-04-16 17:12 UTC] knightar at gmail dot com
Like I said, My patch was a quick fix. =] I suspected http://m.tacker.org/trac/File_Bittorrent/browser/trunk/File/Bittorrent/MakeTorrent.php#L254 had something to do with checking it, but since there wasnt anything being returned it would always false. So I took the example of http://m.tacker.org/trac/File_Bittorrent/browser/trunk/File/Bittorrent/MakeTorrent.php#L247 and put a 'return true'. Wasnt sure what it was supposed to do and all, but it works perfectly with the 'return true' on directories.
 [2006-07-02 17:15 UTC] tacker at php dot net (Markus Tacker)
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/56