php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67131 setcookie() conditional for empty values not met
Submitted: 2014-04-25 05:11 UTC Modified: 2015-08-24 20:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jpingel at bitpiston dot com Assigned: cmb (profile)
Status: Closed Package: HTTP related
PHP Version: 5.5.11 OS: Ubuntu 14.04 x64
Private report: No CVE-ID: None
 [2014-04-25 05:11 UTC] jpingel at bitpiston dot com
Description:
------------
The conditional to check for an empty value when using setcookie() to work around old versions of MSIE not deleting a cookie never seems to be met:
https://github.com/php/php-src/blob/php-5.5.11/ext/standard/head.c#L113

Currently the setcookie() tests pass as it appears that it was never taken into consideration on the first test:
https://github.com/php/php-src/blob/php-5.5.11/ext/standard/tests/network/setcookie.phpt#L8

value && value_len == 0

this should probably be:

value == NULL || value_len == 0


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-24 20:58 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2015-08-24 20:58 UTC] cmb@php.net
Good catch! Thanks for the report and the analysis – and sorry for
the late reply.

A minor correction: the respective branch would be met, if an
empty string (or a value that is converted to an empty string,
such as NULL) is passed as $value parameter. So yes, obviously a
bug.
 [2015-08-24 21:17 UTC] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fc203fa37eb0454c94e7e30f3b4e5fc81b699699
Log: Fix #67131: setcookie() conditional for empty values not met
 [2015-08-24 21:17 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 [2015-09-03 18:10 UTC] ab@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fc203fa37eb0454c94e7e30f3b4e5fc81b699699
Log: Fix #67131: setcookie() conditional for empty values not met
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC