note 68084 deleted from function.session-start by peehaa

From: Date: Fri, 09 Dec 2016 22:24:02 +0000
Subject: note 68084 deleted from function.session-start by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208355@lists.php.net to get a copy of this message
Note Submitter: saykyo (mail at gmail dot com) ---- 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.

« previous php.notes (#208355) next »