Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
31a25fb4
Unverified
Commit
31a25fb4
authored
May 18, 2019
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3049437
by mfb, amateescu: SharedTempStore not serializable on PHP 7.3
parent
1eaf8e63
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/TempStore/SharedTempStore.php
+3
-0
3 additions, 0 deletions
core/lib/Drupal/Core/TempStore/SharedTempStore.php
core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php
+29
-0
29 additions, 0 deletions
...tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php
with
32 additions
and
0 deletions
core/lib/Drupal/Core/TempStore/SharedTempStore.php
+
3
−
0
View file @
31a25fb4
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Drupal\Core\TempStore
;
namespace
Drupal\Core\TempStore
;
use
Drupal\Core\DependencyInjection\DependencySerializationTrait
;
use
Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
;
use
Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
;
use
Drupal\Core\Lock\LockBackendInterface
;
use
Drupal\Core\Lock\LockBackendInterface
;
use
Symfony\Component\HttpFoundation\RequestStack
;
use
Symfony\Component\HttpFoundation\RequestStack
;
...
@@ -37,6 +38,8 @@
...
@@ -37,6 +38,8 @@
*/
*/
class
SharedTempStore
{
class
SharedTempStore
{
use
DependencySerializationTrait
;
/**
/**
* The key/value storage object used for this data.
* The key/value storage object used for this data.
*
*
...
...
This diff is collapsed.
Click to expand it.
core/tests/Drupal/Tests/Core/TempStore/SharedTempStoreTest.php
+
29
−
0
View file @
31a25fb4
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
use
Drupal\Tests\UnitTestCase
;
use
Drupal\Tests\UnitTestCase
;
use
Drupal\Core\TempStore\SharedTempStore
;
use
Drupal\Core\TempStore\SharedTempStore
;
use
Drupal\Core\TempStore\TempStoreException
;
use
Drupal\Core\TempStore\TempStoreException
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\RequestStack
;
use
Symfony\Component\HttpFoundation\RequestStack
;
...
@@ -382,4 +383,32 @@ public function testDeleteIfOwner() {
...
@@ -382,4 +383,32 @@ public function testDeleteIfOwner() {
$this
->
assertFalse
(
$this
->
tempStore
->
deleteIfOwner
(
'test_3'
));
$this
->
assertFalse
(
$this
->
tempStore
->
deleteIfOwner
(
'test_3'
));
}
}
/**
* Tests the serialization of a shared temp store.
*/
public
function
testSerialization
()
{
// Add an unserializable request to the request stack. If the tempstore
// didn't use DependencySerializationTrait, the exception would be thrown
// when we try to serialize the tempstore.
$request
=
$this
->
prophesize
(
Request
::
class
);
$request
->
willImplement
(
'\Serializable'
);
$request
->
serialize
()
->
willThrow
(
new
\LogicException
(
'Oops!'
));
$unserializable_request
=
$request
->
reveal
();
$this
->
requestStack
->
push
(
$unserializable_request
);
$this
->
requestStack
->
_serviceId
=
'request_stack'
;
$container
=
$this
->
prophesize
(
ContainerInterface
::
class
);
$container
->
get
(
'request_stack'
)
->
willReturn
(
$this
->
requestStack
);
$container
->
has
(
'request_stack'
)
->
willReturn
(
TRUE
);
\Drupal
::
setContainer
(
$container
->
reveal
());
$store
=
unserialize
(
serialize
(
$this
->
tempStore
));
$this
->
assertInstanceOf
(
SharedTempStore
::
class
,
$store
);
$request_stack
=
$this
->
getObjectAttribute
(
$store
,
'requestStack'
);
$this
->
assertEquals
(
$this
->
requestStack
,
$request_stack
);
$this
->
assertSame
(
$unserializable_request
,
$request_stack
->
pop
());
}
}
}
This diff is collapsed.
Click to expand it.
Alex Pott
@alexpott
mentioned in commit
4615f549
·
May 18, 2019
mentioned in commit
4615f549
mentioned in commit 4615f549de110d2bc98d6bde33b7faa071c0d7dd
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment