note 68084 added to function.session-start

From: Date: Wed, 12 Jul 2006 15:23:23 +0000
Subject: note 68084 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-114700@lists.php.net to get a copy of this message
Watch out for using UTF-8 encoding in your php scripts! I don't know about other enviroments, but in Windows XP, if you edit a document and set it to be UTF-8, the editor (notepad for exapmle) inserts two invisible bytes at the beginning of the file (they read FF FE in hex for me). I suppose this happens so Windows can identify the file as UTF-8. Since these two bytes are placed before anything else in the file, including <? ?> tags, when you execute the php script, they get outputed to the browser (even tough they won't be shown in the source of the result document, they're there!) before your php code gets a chance to run anything. This effectively cripples functions like session_start() ($_COOKIE to be exact). The solution is to save the php file in a different encoding, or to manually remove them (I prefer the former). I hope I helped somebody. ---- Server IP: 195.46.80.5 Probable Submitter: 87.197.151.244 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/note/edit/68084 Del: integrated -- http://master.php.net/note/delete/68084/integrated Del: useless -- http://master.php.net/note/delete/68084/useless Del: bad code -- http://master.php.net/note/delete/68084/bad+code Del: spam -- http://master.php.net/note/delete/68084/spam Del: non-english -- http://master.php.net/note/delete/68084/non-english Del: in docs -- http://master.php.net/note/delete/68084/in+docs Del: other reasons-- http://master.php.net/note/delete/68084 Reject -- http://master.php.net/note/reject/68084 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#114700) next »