Changeset 24 for trunk

Show
Ignore:
Timestamp:
21.06.2005 09:28:30 (4 years ago)
Author:
m
Message:

Fixed bug 4570 completely.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/File/Bittorrent/Decode.php

    r19 r24  
    340340    function _decode_list() 
    341341    { 
     342        $return = array(); 
    342343        $char = $this->_getChar(); 
    343344        while ($this->_source{$this->_position} != 'e') { 
  • trunk/bugs/bug-4570.php

    r18 r24  
    1616$decoder = new File_Bittorrent_Decode; 
    1717$encoder = new File_Bittorrent_Encode; 
     18error_reporting(E_ALL); 
    1819 
    1920$data = array( 
     
    5354print_r($decode2); 
    5455 
    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); 
    5963 
    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); 
     65echo "\n"; 
     66echo "User_array:\n"; 
     67var_dump($user_array); 
     68echo "\n\n"; 
     69echo "Encoded user_array:\n"; 
     70echo $user_array_encoded . "\n\n"; 
     71echo "Decoded encoded user_array:\n"; 
     72var_dump($decoder->decode($user_array_encoded)); 
     73echo "\n\n"; 
    8474 
    85 echo "\n\n" . 'What The!? Hello World! :)'; 
    8675echo '</pre>'; 
    8776