note 59925 added to reserved.variables

From: Date: Tue, 20 Dec 2005 13:02:28 +0000
Subject: note 59925 added to reserved.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-100461@lists.php.net to get a copy of this message
The following code is licensed under the GPL and it is from the gallery.menalto.com project. <?php /** * Fix the superglobal $_COOKIE to conform with RFC 2965 * * We don't use $_COOKIE[$cookiename], because it doesn't conform to RFC 2965 (the * cookie standard), i.e. in $_COOKIE, we don't get the cookie with the most specific path for * a given cookie name, we get the cookie with the least specific cookie path. * This function does it exactly the other way around, to a) fix our cookie/login problems and * to b) conform with the RFC. * The PHP bug was already fixed in spring 2005, but we will have to deal with broken PHP * versions for a long time. See http://bugs.php.net/bug.php?id=32802. * * Fixes also another PHP cookie bug. PHP doesn't expect the cookie header to have * quoted-strings, but they are perfectly legal according to RFC 2965. * * The third bug fixed here is an MS Internet Explorer (IE) bug. When using default cookie * domains (no leading dot, don't set the domain in set-cookie), IE is supposed to return only * cookies that have the exact request-host as their domain. * Example: Cookies stored in the browser with cookie domains: .example.com, .www.example.com, * example.com, www.example.com * The request-host is www.example.com. Thus, IE should return all those cookies but * the example.com cookie, because it's a default domain cookie and it doesn't match * exactly the request-host. But IE returns the example.com cookie too. * As MS decided that it returns the cookie with the best domain-match first (unspecified in * RFC 2965), this wouldn't be a problem if PHP didn't select the last cookie in the * HTTP_COOKIE header. But with fixCookieVars(), this case is also fixed. * * This function reevaluates the HTTP Cookie header and populates $_COOKIE with the correct * cookies. We fix only non-array and non '[', ']' containing cookies for simplicity. To fix * our login problem, we'd have to fix only the GALLERYSID cookie anyway. * * @param boolean force the reevaluation of the HTTP header string Cookie * @param boolean unset static variable for testability */ function fixCookieVars($force=false, $unset=false) ?> The source code can be found at: http://cvs.sourceforge.net/viewcvs.py/gallery/gallery2/ modules/core/classes/GalleryUtilities.class?rev=1.146&view=markup ---- Manual Page -- http://www.php.net/manual/en/reserved.variables.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59925 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59925&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59925&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100461) next »