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 1616 \Magento \Framework \App \Response \Http::class => \Magento \TestFramework \Response::class,
1717 \Magento \Framework \Interception \PluginListInterface::class =>
1818 \Magento \TestFramework \Interception \PluginList::class,
19+ \Magento \Framework \Serialize \SerializerInterface::class =>
20+ \Magento \TestFramework \Serialize \Serializer::class,
1921 \Magento \Framework \Interception \ObjectManager \ConfigInterface::class =>
2022 \Magento \TestFramework \ObjectManager \Config::class,
2123 \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()
186186 ),
187187 function ($ classFile ) {
188188 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 ;
191191 }
192192 );
193193 $ namespacePattern = '/namespace [a-zA-Z0-9 \\\\]+;/ ' ;
You can’t perform that action at this time.
0 commit comments