#39950 [Opn->Bgs]: ob_start not work

From: Date: Tue, 26 Dec 2006 09:48:05 +0000
Subject: #39950 [Opn->Bgs]: ob_start not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106883@lists.php.net to get a copy of this message
ID: 39950 Updated by: tony2001@php.net Reported By: phunsanit at hotmail dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: windows xp PHP Version: 4.4.4 New Comment: Remove BOM from the beginning of the file. Previous Comments: ------------------------------------------------------------------------ [2006-12-26 07:48:12] phunsanit at hotmail dot com ok i found it error when use utf-8 (i tranfer from ansi witc editplus 2.3) now transfer back to ansi it work php non subport utf-8 ? ------------------------------------------------------------------------ [2006-12-26 07:07:06] phunsanit at hotmail dot com same as this test.php <?php ob_start(); echo'eeeeeeeeeeeeeee bug'; setcookie("TestCookie", $value, time()+3600); ob_end_flush(); ?> return eeeeeeeeeeeeeee bug Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\ob.php:1) in C:\AppServ\www\ob.php on line 4 ------------------------------------------------------------------------ [2006-12-26 06:55:10] phunsanit at hotmail dot com Description: ------------ i think ob_start not work try no appserv 2.4.7 and 2.5.7 windows xp with ajax frame work Reproduce code: --------------- // * ALL.php for Ahtoring <?php ob_start(); header('Content-Type: text/html; charset=utf-8'); define('CONTENTS', true); include_once('dynamic/dynamic.php'); echo"\n<! window fragment>\n"; if(isset($_REQUEST['modules'])){ $modules = $_REQUEST['modules']; if(isset($_REQUEST['file'])){ include_once("dynamic/modules/$modules/".$_REQUEST['file']); }else{ include_once("dynamic/modules/$modules/contents.php"); } }else{ header("location : index.php"); } /* $error = $db->sql_error($result); foreach ($error as $value) { echo "<br />$value\n"; } */ echo"\n<! window fragment>\n"; ob_end_flush(); ?> // login script <?php if (!defined('CONTENTS')) { die ('<div class="blockError">You can\'t access this file directly...</div>'); } function form(){ ?> <div align="center"> <form method="post" action="all.php?modules=Pitt_Accounts&op=login" onsubmit="return post(this ,'content');"> <table> <tr> <td colspan="2">&#3626;&#3617;&#3634;&#3594;&#3636;&#3585;&#3648;&#3586;&#3657;&#3634;&#3626;&#3641;&#3656;&#3619;&#3632;&#3610;&#3610;</td> </tr> <tr> <td>&#3594;&#3639;&#3656;&#3629;&#3648;&#3619;&#3637;&#3618;&#3585;:</td> <td><input name="username" type="text" size="15" maxlength="25" /></td> </tr> <tr> <td>&#3619;&#3627;&#3633;&#3626;&#3612;&#3656;&#3634;&#3609;:</td> <td><input name="user_password" type="text" size="15" maxlength="20" /></td> </tr> <tr> <td colspan="2"> <input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /> </td> </tr> </table> </form> </div> <?php } function login(){ global $db; $user = $_POST['username']; $passwd = $_POST['user_password']; $sql = "SELECT * FROM pitt_accounts WHERE username ='$user'"; $result = $db->sql_query($sql); $field = $db->sql_fetchrow($result); $pitt_uid = $field['user_id']; $adusr = $field['username']; $valid_user = strcmp($user, $adusr); $valid_passwd = strcmp(md5($passwd), $field['password']); if ($valid_user == 0 && $valid_passwd == 0) { /* &#3606;&#3657;&#3634;&#3594;&#3639;&#3656;&#3629;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657;&#3649;&#3621;&#3632;&#3619;&#3627;&#3633;&#3626;&#3612;&#3656;&#3634;&#3609;&#3606;&#3641;&#3585;&#3605;&#3657;&#3629;&#3591; &#3648;&#3619;&#3634;&#3592;&#3632;&#3626;&#3619;&#3657;&#3634;&#3591; session pitt_uid &#3607;&#3637;&#3656;&#3648;&#3585;&#3655;&#3610;&#3619;&#3627;&#3633;&#3626;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657; pitt_user &#3648;&#3585;&#3655;&#3610;&#3594;&#3639;&#3656;&#3629;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657; pitt_group &#3648;&#3585;&#3655;&#3610;&#3585;&#3621;&#3640;&#3656;&#3617;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657; */ $ip = ''.getenv("REMOTE_ADDR").''; $time = 'sign in '.date("Y-m-d ,H:i").''; $sql="INSERT INTO pitt_accounts_log ( user_id , sign , ip ) VALUES ( '$pitt_uid', '$time', '$ip');"; $db->sql_query($sql); /* CSLOX &#3651;&#3594;&#3657; php V4.3.1 &#3617;&#3637; BUG &#3652;&#3617;&#3656; SUBPORT output buffering 1 &#3627;&#3657;&#3634;&#3617;&#3626;&#3656;&#3591;&#3586;&#3657;&#3629;&#3617;&#3641;&#3621;&#3585;&#3656;&#3629;&#3609; COOKIE / SESSION 2 &#3648;&#3619;&#3637;&#3618;&#3591;&#3594;&#3639;&#3656;&#3629;&#3605;&#3633;&#3623;&#3649;&#3611;&#3619;&#3604;&#3657;&#3623;&#3618; ? 3 &#3623;&#3656;&#3634;&#3591;&#3654; &#3626;&#3656;&#3591; chang Log &#3652;&#3611;&#3651;&#3627;&#3657;&#3604;&#3641;&#3604;&#3657;&#3623;&#3618; */ setcookie('pitt_uid' ,$pitt_uid ,time()+2592000); // setcookie('pitt_group' ,$field['group'] ,time()+2592000); setcookie('pitt_user' ,$adusr ,time()+2592000); $_SESSION['pitt_group'] = $field['group']; $client++; setcookie("client[$client]", urlencode("window.parent.location='admin.php?session=".rand()."';")); }else{ $client++; setcookie("client[$client]", urlencode("alert('&#3619;&#3627;&#3633;&#3626; &#3627;&#3619;&#3639;&#3629; &#3594;&#3639;&#3656;&#3629;&#3612;&#3641;&#3657;&#3651;&#3594;&#3657;&#3612;&#3636;&#3604;');")); } } switch($_REQUEST['op']){ case 'login': { login(); break;} case 'logout' : { setcookie('pitt_uid'); setcookie('pitt_user'); unset($_SESSION['pitt_group']); $client++; setcookie("client[$client]", urlencode("window.parent.location='admin.php?session=".rand()."';")); break; } default : { form(); } } ?> Expected result: ---------------- Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\SCT_CSS\all.php:1) in C:\AppServ\www\SCT_CSS\all.php on line 3 &#65279;&#65279;&#65279; Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\SCT_CSS\all.php:1) in C:\AppServ\www\SCT_CSS\dynamic\modules\Pitt_Accounts\contents.php on line 68 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39950&edit=1

« previous php.bugs (#106883) next »