Commit graph

197 commits

Author SHA1 Message Date
Calvin Buckley
180f785404
Note where a session was already started (#10736)
* Note where a session was already started

Duplicated session starts can be annoying to debug. The error that
occurs when a session is already active doesn't tell you where it
was initialized, so figuring out the callsite involves manual
debugging to find it out.

This keeps track of the call site of session_start as a request
global, and frees at the end of the request. It should make it
easier to find these instances for PHP users.

The resulting message can look like:
Notice: session_start(): Ignoring session_start() because a session is already active (started from /home/calvin/src/php-src/inc.php on line 4) in /home/calvin/src/php-src/index.php on line 9

Fixes GH-10721

* Convert to using zend_string for session start location

* Fix leak with session start callsite filename

If this was already initialized, we'd forget it. Have shared free
between session_start and RSHUTDOWN.

* For sessions that are automatically started, note that

Easy to forget that you have this set, in which case, session start
is done at RINIT outside of user code. Because this config option
can't change at runtime, we can check for it and make the error
more specific if that's the case.
2023-03-28 15:14:21 +01:00
George Peter Banyard
51888425da Drop struct union as access is now always named 2022-10-22 12:47:34 +01:00
George Peter Banyard
e8e015777e Use bool instead of int in session struct 2022-08-22 15:45:43 +01:00
George Peter Banyard
4a5699ae2f Session: use more appropriate types 2022-05-29 15:24:06 +01:00
Ilija Tovilo
0db03c4110
Improve sesson write failure message for user error handlers
Closes GH-7787
Closes GH-8186
2022-03-11 15:08:16 +01:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Máté Kocsis
5b5bfd6be4
Generate class entries from stubs for phar, posix, pspell, readline, reflection, session, shmop
Closes GH-6692
2021-02-15 00:11:22 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Máté Kocsis
f293e6b920
Clean up ext/session errors
Closes GH-6111
2020-09-11 11:59:04 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Alex Dowad
af67b06995 SessionUpdateTimestampHandler class was never implemented
It seems that in 2015, work was being done so that users could add their own custom
session handlers. The implementer intended to add a class called
SessionUpdateTimestampHandler, but never did so. The variable which was intended to point
to its class entry is never initialized.

The implementer also coded two methods for this class. Strangely, the method bodies
are declared with PHP_METHOD(SessionHandler, ...) rather than
PHP(SessionUpdateTimestampHandler, ...). However, these method implementations are not
added to the method table of any class or interface. They are just dead code.
2020-04-27 14:51:33 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Kalle Sommer Nielsen
e632537c83 Remove usage of HAVE_HASH_EXT and COMPILE_DL_HASH as ext/hash is always available (master only) 2019-03-20 20:43:35 +02:00
Zeev Suraski
38c337f22e Remove year range from copyright notice 2019-01-30 11:00:23 +02:00
Frederik Bosch
08b9310e6d implement same site cookie see https://bugs.php.net/bug.php?id=72230 see https://tools.ietf.org/html/draft-west-first-party-cookies-07 see https://scotthelme.co.uk/csrf-is-dead/ 2018-07-31 12:40:24 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
83e495e0fd Move constants into read-only data segment 2017-12-14 22:14:36 +03:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Joe Watkins
15b80f105c
Merge branch 'pull-request/2261'
* pull-request/2261:
  Add PHPAPI php_session_flush and php_session_destroy
2017-01-01 06:44:14 +00:00
dreamszhu
e10425fe8b Add PHPAPI php_session_flush and php_session_destroy 2017-01-01 07:30:22 +08:00
dreamszhu
f7f32ba422 Add PHPAPI for session class entry 2016-12-31 18:03:58 +08:00
Yasuo Ohgaki
a93a51c3bf Fix bug #73100 - Improve bug fix. Forbid to set 'user' save handler other than set_save_handler(). 2016-12-22 16:04:28 +09:00
Yasuo Ohgaki
7f196e321f Fix bug #71038 - session_start() returns true even when it failed
PR #2167
2016-11-17 11:09:07 +09:00
Anatol Belski
5eeec01bae keep ABI 2016-11-16 11:21:32 +01:00
Yasuo Ohgaki
3d6e922367 Refactor and cleanup implementation. 2016-11-16 05:08:29 +00:00
Yasuo Ohgaki
7b29c3fba6 Revert "Fix Bug #73461"
This reverts commit 0383de1467.
2016-11-16 05:08:29 +00:00
Yasuo Ohgaki
6230c2bad0 Fix Bug #73461
This patch disables any invalid save handler calls.
2016-11-16 05:08:28 +00:00
Yasuo Ohgaki
a4a2f66e75 Revert "Revert "Implement RFC Add session_gc() https://wiki.php.net/rfc/session-gc""
This reverts commit 355c7e7d1c.
2016-09-01 10:12:26 +09:00
Yasuo Ohgaki
355c7e7d1c Revert "Implement RFC Add session_gc() https://wiki.php.net/rfc/session-gc"
This reverts commit 1cf179e415.
2016-09-01 05:54:55 +09:00
Yasuo Ohgaki
1cf179e415 Implement RFC Add session_gc() https://wiki.php.net/rfc/session-gc 2016-08-29 05:57:37 +09:00
Yasuo Ohgaki
3467526a65 Merge RFC: Session ID without hashing
https://wiki.php.net/rfc/session-id-without-hashing
2016-08-12 12:31:02 +09:00
Dmitry Stogov
ccf4ae95bd Restored signed format specifier 2016-06-21 20:12:04 +03:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Nikita Popov
1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Anatol Belski
3066851dab fix datatype mismatches 2015-03-24 22:02:29 +01:00
Anatol Belski
663074b6b1 cleanup mod version macros and mod defs, round x 2015-03-23 21:30:22 +01:00
Julien Pauli
4d3a3811a9 Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix flaws in session module

Conflicts:
	ext/session/session.c
2015-03-16 16:11:02 +01:00
Julien Pauli
2a50877428 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix flaws in session module
2015-03-16 16:01:12 +01:00
Julien Pauli
4dba99c226 Fix flaws in session module 2015-03-16 16:00:46 +01:00
Anatol Belski
af3ca74501 made ZEND_TSRMLS_CACHE_* macros look like function calls
which also comply with the current semantics for such macros
2015-02-16 17:19:32 +01:00
Yasuo Ohgaki
741b5952c6 Pass maxlifetime to save handlers 2015-02-12 13:07:27 +09:00
Yasuo Ohgaki
f248df9003 Cleanup trans sid code. Behavior is unchanged.
Fixed possible injections. Escape values usually internal safe values.
2015-02-02 17:06:16 +09:00
Yasuo Ohgaki
e6c8640a2a WIP - test passes 2015-01-22 13:34:58 +09:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00