mirror of
https://github.com/php/php-src.git
synced 2024-12-24 01:09:58 +08:00
Revert "Increase serialize_lock while decoding session"
This reverts commit b8ef7c35ab
.
See bug #79031. The semantics of serialize locking aren't quite
correct right now, and the use of the lock in this particular
place makes us hit the issue in a common case. I'm reverting this
commit for PHP 7.4 and will try to fix this properly for PHP 8,
as I believe it will require ABI breakage.
This commit is contained in:
parent
935a61d034
commit
ed3811e781
@ -244,18 +244,11 @@ static zend_string *php_session_encode(void) /* {{{ */
|
||||
|
||||
static int php_session_decode(zend_string *data) /* {{{ */
|
||||
{
|
||||
int res;
|
||||
if (!PS(serializer)) {
|
||||
php_error_docref(NULL, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object");
|
||||
return FAILURE;
|
||||
}
|
||||
/* Make sure that any uses of unserialize() during session decoding do not share
|
||||
* state with any unserialize() that is already in progress (e.g. because we are
|
||||
* currently inside Serializable::unserialize(). */
|
||||
BG(serialize_lock)++;
|
||||
res = PS(serializer)->decode(ZSTR_VAL(data), ZSTR_LEN(data));
|
||||
BG(serialize_lock)--;
|
||||
if (res == FAILURE) {
|
||||
if (PS(serializer)->decode(ZSTR_VAL(data), ZSTR_LEN(data)) == FAILURE) {
|
||||
php_session_destroy();
|
||||
php_session_track_init();
|
||||
php_error_docref(NULL, E_WARNING, "Failed to decode session object. Session has been destroyed");
|
||||
|
@ -18,7 +18,6 @@ class obj implements Serializable {
|
||||
}
|
||||
function unserialize($data) {
|
||||
session_decode($data);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,18 +33,20 @@ for ($i = 0; $i < 5; $i++) {
|
||||
var_dump($data);
|
||||
var_dump($_SESSION);
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
object(obj)#1 (1) {
|
||||
object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
[1]=>
|
||||
object(obj)#2 (1) {
|
||||
object(obj)#%d (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
}
|
||||
array(0) {
|
||||
object(obj)#1 (1) {
|
||||
["data"]=>
|
||||
NULL
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user