Re: Should I document session_get_cookie_params => setcookie?

Peter Cowburn <[email protected]>
Newsgroups gmane.comp.php.documentation.general
Message-ID <CAPg3XxJdubDOUPr5OkALyLdD3O1xNjfK=XEZ3rG5zFdMXP-eGw@mail.gmail.com>
On Tue, 2 Jun 2020 at 09:12, Christoph M. Becker <[email protected]> wrote:

> On 02.06.2020 at 09:35, Peter Cowburn wrote:
>
> > On Tue, 2 Jun 2020 at 02:58, Karoly Negyesi <[email protected]> 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?
>
> Actually, setcookie() is not supposed to fail if there are spurious
> elements in the options array; see e.g. <https://3v4l.org/h4dWr>.
>

E_NOT_ENOUGH_COFFEE -- yes, it should emit the warning(s) but not fail *due
to the extra options*.


>
> --
> Christoph M. Becker
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.