Doc #79609 [Com]: Warning in session_create_id Example #1

From: Date: Mon, 18 May 2020 17:21:31 +0000
Subject: Doc #79609 [Com]: Warning in session_create_id Example #1
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17598@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79609&edit=1 ID: 79609 Comment by: software_onbekend at hotmail dot com Reported by: software_onbekend at hotmail dot com Summary: Warning in session_create_id Example #1 Status: Feedback Type: Documentation Problem Package: Session related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The def. environment is PHP 7.4.3 (xamp installation on Windows). session.auto_start = "Off". "display_errors" and "display_startup_errors" values are "On". Here I get the warnings. Tested example in prod. environment with PHP 7.3.17. session.auto_start = "Off" No warning because the most hosted platform has the "display_errors" and "display_startup_errors" at "Off" so the warnings and errors are suppressed. No output to webbrowser. About the session-status. echo session_status; gives int. as answer in the browser (values 0 or 1 or 2) The explanation of the return values doesn't explain the link between these values 0, 1 & 2. The contributed note from "sasi dot viragelet at gmail dot co" gives the answer. Perhaps we can use that info to improve the documentation. Just my 2 cents. Have a nice day. Previous Comments: ------------------------------------------------------------------------ [2020-05-17 21:59:23] a at b dot c dot de For the first question: The sample code is working fine for me. What version are you using? Do you perhaps have session.auto_start enabled? For the second question: PHP_SESSION_ACTIVE is an integer. ------------------------------------------------------------------------ [2020-05-17 21:59:22] requinix@php.net Are you sure you're looking at https://www.php.net/manual/en/function.session-create-id.php? Because, > Warning: session_create_id(): Failed to create new ID in index.php on line 20. > Generating new session id is not allowed when the session is already started. The example is working for me. > Also at line 16, the if statement need an integer because the output of session_status is an > integer. It does that already. > Can the documentation for the "session-status" also be updated with the integer > return values? It does that too. > The example also uses "session_commit()", this is an alias of > "session_write_close", wouldn't it be > better to use "session_write_close" instead of "session_commit" ? The alias is not deprecated, but it probably would be better, yes. ------------------------------------------------------------------------ [2020-05-17 20:46:35] software_onbekend at hotmail dot com Description: ------------ --- From manual page: https://php.net/function.session-create-id --- Warning: session_create_id(): Failed to create new ID in index.php on line 20. Generating new session id is not allowed when the session is already started. Also at line 16, the if statement need an integer because the output of session_status is an integer. https://www.php.net/manual/en/function.session-status.php Can the documentation for the "session-status" also be updated with the integer return values? The example also uses "session_commit()", this is an alias of "session_write_close", wouldn't it be better to use "session_write_close" instead of "session_commit" ? https://www.php.net/manual/en/function.session-commit.php Have a nice day ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79609&edit=1

« previous php.doc.bugs (#17598) next »