|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59099 http_build_cookie() exhausts memory if cookie value is NULL
Submitted: 2010-03-04 09:26 UTC Modified: 2010-04-27 09:43 UTC
From: justin dot forest at gmail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.3.1 OS: Ubuntu Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: justin dot forest at gmail dot com
New email:
PHP Version: OS:


 [2010-03-04 09:26 UTC] justin dot forest at gmail dot com
If cookie value is NULL, http_build_cookies() tries to 
allocate too much memory 
for some reason.

HTTP extension version is 1.6.6. I can reproduce this with 
PHP versions 5.2.8 and 
5.3.1 on Ubuntu, but not in 5.2.12 on FreeBSD.

Passing cookie value through strval() helps.

Reproduce code:
  'cookies' => array(
    'empty' => null,

Expected result:
$ php -f test-cookies.php 
string(8) "empty=; "

Actual result:
$ php -f test-cookies.php 

Fatal error: Allowed memory size of 33554432 bytes exhausted 
(tried to allocate 
441559261 bytes) in .../test-cookies.php on line 7


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-27 09:43 UTC]
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 12:01:28 2024 UTC