Doc #74231 [NEW]: Example #2 for session_regenerate_id is broken in several ways

From: Date: Fri, 10 Mar 2017 00:41:40 +0000
Subject: Doc #74231 [NEW]: Example #2 for session_regenerate_id is broken in several ways
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14490@lists.php.net to get a copy of this message
From:             signe at cothlamadh dot net
Operating system: n/a
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Example #2 for session_regenerate_id is broken in several ways

Description:
------------
Example #2 does carry the caveat that it's "not fully working code,"
however it's not just "not fully working" - it's badly broken, uses
php.ini options incorrectly, and non-functional.

1. The modification of use_strict_mode is wrapping the wrong function.

use_strict_mode restricts calling session_id() with a new value. 
Calling session_id() before unlocking use_strict_mode will result in a
logged warning.

2. The example function does _not_ preserve any existing session data,
which session_regenerate_id does.  Anyone using the example would lose
all session data for the user.

Before calling session_start(), you need to store the current session
data temporarily in memory, and then restore it afterward.

Documentation patch attached


-- 
Edit bug report at https://bugs.php.net/bug.php?id=74231&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74231&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74231&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74231&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74231&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74231&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74231&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74231&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74231&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74231&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74231&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74231&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74231&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74231&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74231&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74231&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74231&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74231&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74231&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74231&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74231&r=mysqlcfg



Thread (6 messages)

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