php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27955 Ctrl-D produces bad output
Submitted: 2004-04-11 18:34 UTC Modified: 2004-04-12 05:44 UTC
From: jkmail at tpg dot com dot au Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.0.0RC1 OS: FreeBSD 4.9
Private report: No CVE-ID: None
 [2004-04-11 18:34 UTC] jkmail at tpg dot com dot au
Description:
------------
When executing this code from STDIN (via CLI), an extra 'D' character appears in the output for the first time the function is executed.

It behaves normally when its reading the code from a file. Could this be the 'D' character from the 'Ctrl-D' combination somehow appearing?

Configure:
'./configure' '--prefix=/usr/local/php5' '--with-apxs2' '--disable-cgi' '--disable-ipv6' '--with-openssl' '--enable-bcmath' '--with-bzip2' '--with-curl' '--with-gd' '--enable-gd-native-ttf' '--with-imap' '--with-mysql=/usr/local/lib/mysql' '--enable-soap' '--with-xmlrpc' '--with-zlib-dir=/usr'

Reproduce code:
---------------
<?php
function a() {
	$var = 4;
	print $var . "\n";
}

a();
a();
?>

Expected result:
----------------
4
4

Actual result:
--------------
4D
4

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-11 18:53 UTC] jkmail at tpg dot com dot au
Did a little more testing, and this is more of an input/output issue.

Code:
<?= "\n" . 4 . "\n" ?>
Produces:
^D
4

PHP4 did not suffer from this issue.
 [2004-04-11 19:27 UTC] jkmail at tpg dot com dot au
Sorry folks,

It just didn't reproduce on linux/php4 (I tested it on linux, as I didn't have php4 installed on the freebsd machine at the time). This seems to be a FreeBSD specific issue. 

This seems to be a problem with other languages like perl as well, so this bug could very well be marked as bogus. I don't like how it messes up the output though. Is there a way we can clear the buffer or something?
 [2004-04-12 05:44 UTC] derick@php.net
Nope, no clue "how to clear a buffer".
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jul 02 12:05:45 2022 UTC