| Newsgroups |
php.notes |
| Message-ID |
<[email protected]> |
This is largely speculation based on what I can see in php-src - it appears that the `$data` argument is included for two reasons:
1. If you subclass `SessionHandler` and implement `SessionUpdateTimestampHandlerInterface`, your `updateTimestamp()` method may be called - but you can't call `parent::updateTimestamp()` because that method isn't implemented on `SessionHandler`. So instead you must call `parent::write()` which means you need the data to avoid overriding it with a blank session.
2. This simplifies the source code for PHP, since depending on whether there _is_ data and whether lazy `session.lazy_write` is enabled, either this method or `write()` will be called when the session is closed. Having the same arguments means only the name of the method being called has to change, not the arguments.
The second reason feels a bit flakey so I don't trust my own reasoning there. But the first reason seems sound.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 14.1.35.58)
----
Manual Page -- https://php.net/manual/en/sessionupdatetimestamphandlerinterface.updatetimestamp.php
Edit -- https://main.php.net/note/edit/130253
Del: integrated -- https://main.php.net/note/delete/130253/integrated
Del: useless -- https://main.php.net/note/delete/130253/useless
Del: bad code -- https://main.php.net/note/delete/130253/bad+code
Del: spam -- https://main.php.net/note/delete/130253/spam
Del: non-english -- https://main.php.net/note/delete/130253/non-english
Del: in docs -- https://main.php.net/note/delete/130253/in+docs
Del: other reasons-- https://main.php.net/note/delete/130253
Reject -- https://main.php.net/note/reject/130253
Search -- https://main.php.net/manage/user-notes.php