- Timestamp:
- 21.06.2005 09:28:30 (4 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
File/Bittorrent/Decode.php (modified) (1 diff)
-
bugs/bug-4570.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/File/Bittorrent/Decode.php
r19 r24 340 340 function _decode_list() 341 341 { 342 $return = array(); 342 343 $char = $this->_getChar(); 343 344 while ($this->_source{$this->_position} != 'e') { -
trunk/bugs/bug-4570.php
r18 r24 16 16 $decoder = new File_Bittorrent_Decode; 17 17 $encoder = new File_Bittorrent_Encode; 18 error_reporting(E_ALL); 18 19 19 20 $data = array( … … 53 54 print_r($decode2); 54 55 55 // Uncomment these lines if you want to see it completely hang (indefinate loop) 56 // The string was created by File_Bittorrent_Encode, but it's too hard to reproduce. 57 // $string = 'd10:additional8:password32:8943f909f9c2e98f44fa6ffa2ea470eb9:pwdlengthi6e8:username6:nagash8:usertype1:3e'; 58 // echo $decoder->decode($string); 56 $user_array = array( 57 'additional' => array(), 58 'password' => '8943f909f9c2e98f44fa6ffa2ea470eb', 59 'pwdlength' => 6, 60 'username' => 'nagash', 61 'usertype' => '3', 62 ); 59 63 60 // tacker: I can confirm that, but I need the original array to verify that this is an actual result of Decode 61 // tacker: I think that you used an array like this: 62 /* 63 $user_array = array( 64 'additional' => array( 65 'password' => '8943f909f9c2e98f44fa6ffa2ea470eb', 66 'pwdlength' => 6, 67 ), 68 'username' => 'nagash', 69 'usertype' => '3', 70 ); 71 */ 72 // tacker: This produces d10:additionald8:password32:8943f909f9c2e98f44fa6ffa2ea470eb9:pwdlengthi6ee8:username6:nagash8:usertype1:3e 73 // tacker: which can be decoded properly 74 /* 75 $user_array_encoded = $encoder->encode($user_array); 76 echo "\n"; 77 echo "User_array:\n"; 78 echo print_r($user_array) . "\n"; 79 echo "Encoded user_array:\n"; 80 echo $user_array_encoded . "\n"; 81 echo "Decoded encoded user_array:\n"; 82 echo print_r($decoder->decode($user_array_encoded)) . "\n"; 83 */ 64 $user_array_encoded = $encoder->encode($user_array); 65 echo "\n"; 66 echo "User_array:\n"; 67 var_dump($user_array); 68 echo "\n\n"; 69 echo "Encoded user_array:\n"; 70 echo $user_array_encoded . "\n\n"; 71 echo "Decoded encoded user_array:\n"; 72 var_dump($decoder->decode($user_array_encoded)); 73 echo "\n\n"; 84 74 85 echo "\n\n" . 'What The!? Hello World! :)';86 75 echo '</pre>'; 87 76