php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66725 Clarification required as to what happens if domain argument isn't passed
Submitted: 2014-02-17 00:54 UTC Modified: 2016-12-28 13:44 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: jarrod at makin dot co Assigned:
Status: Open Package: Network related
PHP Version: Irrelevant OS:
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jarrod at makin dot co
New email:
PHP Version: OS:

 

 [2014-02-17 00:54 UTC] jarrod at makin dot co
Description:
------------
---
From manual page: http://www.php.net/function.setcookie
---

Clarification is desired to make it clear to me what happens if the domain argument is not passed to this function.

If I set session.cookie_domain in a php.ini file, will it come into play?
If I leave it blank, will php use a variable like $_SERVER["SERVER_NAME"]?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-24 22:42 UTC] chrispmaiden at gmail dot com
Having looked at the source code setcookie() doesn't appear to set the domain unless one is passed to the function, this can be tested by executing this simple script:

<?php
setcookie('testing', '123', time()+60*60*24*30, '/');
print_r(headers_list());

Outputs:
Array
(
    [0] => X-Powered-By: PHP/5.4.21
    [1] => Set-Cookie: testing=123; expires=Wed, 26-Mar-2014 22:27:59 GMT; path=/
)

The argument is optional, it's in square brackets so for me I think the documentation is fine (just my opinion though!)
 [2016-12-28 13:44 UTC] cmb@php.net
-Package: Documentation problem +Package: Network related
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Dec 16 15:01:26 2018 UTC