|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-21 04:14 UTC] jonathan dot aquino at gmail dot com
Description:
------------
http_build_cookie returns false. PHP 5.2.6.
Reproduce code:
---------------
$cookie = http_parse_cookie('RMID=2dab5fc9296749c2f28ec0b7; expires=Saturday, 20-Mar-2010 01:34:06 GMT; path=/; domain=.nytimes.com');
var_dump(http_build_cookie($cookie));
Expected result:
----------------
RMID=2dab5fc9296749c2f28ec0b7
Actual result:
--------------
FALSE
Patchesssss (last revision 2011-08-11 12:19 UTC by ddddd at hotmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
The prototype for http_build_cookie() says that it accepts an array only and the description below it says an array/object. The following: C:\php\src\Release_TS>php -r "$c = http_parse_cookie('RMID=2dab5fc9296749c2f28ec0b7; expires=Saturday, 20-Mar-2010 01:34:06 GMT; path=/;domain=.nytimes.com'); var_dump(http_build_cookie($c));" gives: Warning: http_build_cookie() expects parameter 1 to be array, object given in Command line code on line 1 bool(false) however casting it to an array before passing it to http_build_cookie, like: http_build_cookie((array) $c); makes it work, assigned to Mike so he can clarrify its an error with pecl/http or a documentation issue.