Re: Should I document session_get_cookie_params => setcookie?
| From: | Karoly Negyesi | Date: | Tue, 02 Jun 2020 08:10:02 +0000 |
| Subject: | Re: Should I document session_get_cookie_params => setcookie? | ||
| References: | 1 2 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969387539@lists.php.net to get a copy of this message | ||
I need to fix that commit -- the warning is correct but the return value
will still be TRUE, the NULL comes from something else:
https://3v4l.org/MejIO namely, I tried to run this in PHP 7.2
when I got a
NULL. You still can easily coax a NULL return from setcookie() though:
https://3v4l.org/CSgIB which now probably should go on the
return value
section.
On Tue, Jun 2, 2020 at 12:35 AM Peter Cowburn <petercowburn@gmail.com>
wrote:
>
>
> On Tue, 2 Jun 2020 at 02:58, Karoly Negyesi <karoly@negyesi.net> wrote:
>
>> Hello,
>>
>> Today I wanted to check from JavaScript whether a session was started but
>> the system sets the session cookie to httponly so I can't do that so I
>> wanted to do setcookie('has_session', 1, session_get_cookie_params()). This
>> of course (?) doesn't work. Should I add a code snippet on how to make it
>> work to session_get_cookie_params and / or setcookie or should I just
>> submit to Stackoverflow as a self answer?
>>
>
> Probably the latter.
>
>
>> I already added
>> https://marc.info/?l=php-doc-cvs&m=159105012229429&w=2
>> because that's generic enough. Speaking of, should I amend the return
>> values of setcookie to include this null or just this commit is enough?
>>
>
> I'm not sure where the null is coming from. The function should be
> returning false for the case you've described, right?
>
>
>>
>> Best,
>>
>> NK
>>
>>