File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed
framework/Magento/TestFramework Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 16
16
\Magento \Framework \App \Response \Http::class => \Magento \TestFramework \Response::class,
17
17
\Magento \Framework \Interception \PluginListInterface::class =>
18
18
\Magento \TestFramework \Interception \PluginList::class,
19
+ \Magento \Framework \Serialize \SerializerInterface::class =>
20
+ \Magento \TestFramework \Serialize \Serializer::class,
19
21
\Magento \Framework \Interception \ObjectManager \ConfigInterface::class =>
20
22
\Magento \TestFramework \ObjectManager \Config::class,
21
23
\Magento \Framework \Interception \ObjectManager \Config \Developer::class =>
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \TestFramework \Serialize ;
10
+
11
+ use Magento \Framework \Serialize \SerializerInterface ;
12
+
13
+ /**
14
+ * Insecure SerializerInterface implementation for test use only.
15
+ */
16
+ class Serializer implements SerializerInterface
17
+ {
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ public function serialize ($ data )
22
+ {
23
+ if (is_resource ($ data )) {
24
+ throw new \InvalidArgumentException ('Unable to serialize value. ' );
25
+ }
26
+
27
+ // phpcs:ignore Magento2.Security.InsecureFunction
28
+ return serialize ($ data );
29
+ }
30
+
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ public function unserialize ($ string )
35
+ {
36
+ if (false === $ string || null === $ string || '' === $ string ) {
37
+ throw new \InvalidArgumentException ('Unable to unserialize value. ' );
38
+ }
39
+ set_error_handler (
40
+ function () {
41
+ restore_error_handler ();
42
+ throw new \InvalidArgumentException ('Unable to unserialize value, string is corrupted. ' );
43
+ },
44
+ E_NOTICE
45
+ );
46
+ // phpcs:ignore Magento2.Security.InsecureFunction
47
+ $ result = unserialize ($ string );
48
+ restore_error_handler ();
49
+
50
+ return $ result ;
51
+ }
52
+ }
Original file line number Diff line number Diff line change @@ -186,8 +186,8 @@ public static function backupStaticVariables()
186
186
),
187
187
function ($ classFile ) {
188
188
return StaticProperties::_isClassInCleanableFolders ($ classFile )
189
- // phpcs:ignore Magento2.Functions.DiscouragedFunction
190
- && strpos (file_get_contents ($ classFile ), ' static ' ) > 0 ;
189
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
190
+ && strpos (file_get_contents ($ classFile ), ' static ' ) > 0 ;
191
191
}
192
192
);
193
193
$ namespacePattern = '/namespace [a-zA-Z0-9 \\\\]+;/ ' ;
You can’t perform that action at this time.
0 commit comments