[PHP-DEV] Bug #941 Updated: outputs many characters after null character in strings From: Bug Database (php-dev <email protected>)
Date: 11/23/98

ID: 941
User Update by: mangino <email protected>
Status: Open
Bug Type: Misbehaving function
Description: outputs many characters after null character in strings

I'm using both Netscape Communicator 4.5 and lynx on linux and I get some wierd text after the outputting of character streams that have been converted from ints or longs. It appears that your conversion functions may not properly place a null value or more likely the echo function prints to much. Maybe the length isn' set right? Anyway, I have an od-c attached as well as the source that seems to cause the problem. newest apache is serving.

source from lynx piped through octal dump

0000000 \n < H T M L > \n < H E A D > \n <
0000020 T I T L E > \n A d d a c a r
0000040 t y p e \n < / T I T L E > \n <
0000060 / H E A D > \n < B O D Y B G C
0000100 O L O R = # f f f f f f > \n \n <
0000120 F O R M A C T I O N = " a d d
0000140 _ c a r _ t y p e . p h p 3 "
0000160 M E T H O D = P O S T > \n < T A
0000200 B L E B O R D E R = 3 > \n < T
0000220 R > < T D > M a n u f a c t u r
0000240 e r < / T D > < T D > M a k e <
0000260 / T D > < T D > M o d e l < / T
0000300 D > < T D > Y e a r < / T D > <
0000320 / T R > \n < T R > < T D > \n < S
0000340 E L E C T N A M E = M A N U F
0000360 A C T U R E R _ I D > \n < O P
0000400 T I O N V A L U E = 1 . 0 \0 d
0000420 d a t a b a s e c o n t e x
0000440 t t o ' m > 0 \n < O P T I
0000460 O N V A L U E = 2 . 0 \0 f a c
0000500 t u r e r \0 \0 \0 \0 h 005 \0 \0 @ \0 \0
0000520 \0 220 023 022 \b > 0 \n < O P T I O N
0000540 V A L U E = 3 . 0 \0 340 037 022 \b 220
0000560 \0 \0 \0 220 \0 \0 \0 n a m e \0 \0 \0 \0 \0
0000600 \0 \0 \0 > 0 \n < O P T I O N V
0000620 A L U E = 4 . 0 \0 \0 \0 \0 \0 \0 \0 \0
0000640 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000660 \0 > 0 \n < O P T I O N V A L
0000700 U E = 5 . 0 \0 \b 022 \b 005 \0 \0 \0 \0
0000720 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 >
0000740 0 \n < O P T I O N V A L U E
0000760 = 6 . 0 \0 330 036 022 \b \t \0 \0 \0 \0 \0 \0
0001000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 > 0
0001020 \n < O P T I O N V A L U E = 7
0001040 . 0 \0 { \n \t \t e c h o ( " < T
0001060 D > " ) ; \n \t \t $ i n > 0 \n <
0001100 / S E L E C T > \n \n < / T D > \n
0001120 < T D > < I N P U T T Y P E =
0001140 T E X T N A M E = M A K E > <
0001160 / T D > \n < T D > < I N P U T
0001200 T Y P E = T E X T N A M E = M
0001220 O D E L > < / T D > \n < T D > <
0001240 I N P U T T Y P E = T E X T
0001260 N A M E = Y E A R > < / T D > \n
0001300 < T D > < I n p u t T Y P E =
0001320 S U B M I T V A L U E = " A d
0001340 d t o D a t a b a s e " > <
0001360 / T D > \n < / T R > \n < / T A B
0001400 L E > \n < B R > < B R > \n < / F
0001420 O R M > \n < / B O D Y > < / H T
0001440 M L > \n
0001444

/*******************************************************
********FUNCTION THAT CAUSES THE ERROR***/
function make_select($results) {
   $rows = sybase_num_rows($results);
   $fields = sybase_num_fields($results);

   for ($i=0; $i< $rows; $i++) {
        sybase_data_seek($results,$i);
        $row = sybase_fetch_row($results);
        echo ("<OPTION VALUE=$row[0]>");
        for ($j=1; $j < $fields; $j++) {
                   echo(" $row[$j]");
        }
        echo("\n");
   }
}

Full Bug description available at: http://ca.php.net/bugs.php3?id=941

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>