Bug #920: printf will not echo out NULL byte

From: Date: Sun, 15 Nov 1998 07:20:52 +0000
Subject: Bug #920: printf will not echo out NULL byte
Groups: php.dev 
Request: Send a blank email to php-dev+get-2410@lists.php.net to get a copy of this message
From: jordy@wserv.com Operating system: Linux PHP version: 3.0.4 PHP Bug Type: Misbehaving function Bug description: printf will not echo out NULL byte This should print out a NULL byte to the web browser, however it doesn't print anything. The same code in C and Perl will print a NULL byte out to the web browser. This is required to implement special protocols which require NULL bytes to be sent out. # cat test.php3 <?php printf("%c", 0); ?> # socket -v localhost 80 > output GET /test.php3 HTTP/1.0 # cat -A output HTTP/1.1 200 OK^M$ Date: Sun, 15 Nov 1998 07:18:42 GMT^M$ Server: Apache/1.3.2 (Unix) PHP/3.0.4 FrontPage/3.0.4.2 mod_ssl/2.0.11 SSLeay/0.9.0b^M$ Connection: close^M$ Content-Type: text/html^M$ ^M$ # cat test.pl #!/usr/bin/perl print "Content-type: text/html\n\n"; printf("%c", 0); # socket -v localhost 80 > output GET /test.pl HTTP/1.0 # cat -A output HTTP/1.1 200 OK^M$ Date: Sun, 15 Nov 1998 07:19:53 GMT^M$ Server: Apache/1.3.2 (Unix) PHP/3.0.4 FrontPage/3.0.4.2 mod_ssl/2.0.11 SSLeay/0.9.0b^M$ Connection: close^M$ Content-Type: text/html^M$ ^M$ ^@ Note the ^@ at the end.. it is the NULL which the PERL script prints, but the PHP script does not. -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2410) next »