Skip to content

Commit 690e6b8

Browse files
author
Igor Melnikov
committed
MAGETWO-67187: Verify all serialize/unserialize usages eliminated in CE, remove any missed usages
- removing usages of serialize/unserialize and serialized data
1 parent 65c0b93 commit 690e6b8

File tree

16 files changed

+154
-294
lines changed

16 files changed

+154
-294
lines changed

app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/View/Items/RendererTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function getSelectionAttributesDataProvider()
170170
{
171171
return [
172172
[[], null],
173-
[['bundle_selection_attributes' => 'a:1:{i:0;i:1;}'], [0 => 1]],
173+
[['bundle_selection_attributes' => 'serialized string'], [0 => 1]],
174174
];
175175
}
176176

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/_files/categoryUrlRewritesDataProvider.php

Lines changed: 0 additions & 98 deletions
This file was deleted.

app/code/Magento/Customer/Setup/CustomerSetup.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function getDefaultEntities()
179179
'label' => 'First Name',
180180
'input' => 'text',
181181
'sort_order' => 40,
182-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
182+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
183183
'position' => 40,
184184
],
185185
'middlename' => [
@@ -197,7 +197,7 @@ public function getDefaultEntities()
197197
'label' => 'Last Name',
198198
'input' => 'text',
199199
'sort_order' => 60,
200-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
200+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
201201
'position' => 60,
202202
],
203203
'suffix' => [
@@ -215,7 +215,7 @@ public function getDefaultEntities()
215215
'label' => 'Email',
216216
'input' => 'text',
217217
'sort_order' => 80,
218-
'validate_rules' => 'a:1:{s:16:"input_validation";s:5:"email";}',
218+
'validate_rules' => '{"input_validation":"email"}',
219219
'position' => 80,
220220
'admin_checkout' => 1,
221221
],
@@ -240,7 +240,7 @@ public function getDefaultEntities()
240240
'visible' => false,
241241
'system' => false,
242242
'input_filter' => 'date',
243-
'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}',
243+
'validate_rules' => '{"input_validation":"date"}',
244244
'position' => 90,
245245
'admin_checkout' => 1,
246246
],
@@ -262,7 +262,7 @@ public function getDefaultEntities()
262262
'rp_token_created_at' => [
263263
'type' => 'static',
264264
'input' => 'date',
265-
'validate_rules' => 'a:1:{s:16:"input_validation";s:4:"date";}',
265+
'validate_rules' => '{"input_validation":"date"}',
266266
'required' => false,
267267
'sort_order' => 120,
268268
'visible' => false,
@@ -293,7 +293,7 @@ public function getDefaultEntities()
293293
'sort_order' => 100,
294294
'visible' => false,
295295
'system' => false,
296-
'validate_rules' => 'a:1:{s:15:"max_text_length";i:255;}',
296+
'validate_rules' => '{"max_text_length":255}',
297297
'position' => 100,
298298
'admin_checkout' => 1,
299299
],
@@ -323,7 +323,7 @@ public function getDefaultEntities()
323323
'sort_order' => 110,
324324
'visible' => false,
325325
'system' => false,
326-
'validate_rules' => 'a:0:{}',
326+
'validate_rules' => '[]',
327327
'position' => 110,
328328
'admin_checkout' => 1,
329329
'option' => ['values' => ['Male', 'Female']],
@@ -363,7 +363,7 @@ public function getDefaultEntities()
363363
'label' => 'First Name',
364364
'input' => 'text',
365365
'sort_order' => 20,
366-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
366+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
367367
'position' => 20,
368368
],
369369
'middlename' => [
@@ -381,7 +381,7 @@ public function getDefaultEntities()
381381
'label' => 'Last Name',
382382
'input' => 'text',
383383
'sort_order' => 40,
384-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
384+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
385385
'position' => 40,
386386
],
387387
'suffix' => [
@@ -400,7 +400,7 @@ public function getDefaultEntities()
400400
'input' => 'text',
401401
'required' => false,
402402
'sort_order' => 60,
403-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
403+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
404404
'position' => 60,
405405
],
406406
'street' => [
@@ -410,15 +410,15 @@ public function getDefaultEntities()
410410
'backend' => \Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class,
411411
'sort_order' => 70,
412412
'multiline_count' => 2,
413-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
413+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
414414
'position' => 70,
415415
],
416416
'city' => [
417417
'type' => 'static',
418418
'label' => 'City',
419419
'input' => 'text',
420420
'sort_order' => 80,
421-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
421+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
422422
'position' => 80,
423423
],
424424
'country_id' => [
@@ -452,7 +452,7 @@ public function getDefaultEntities()
452452
'label' => 'Zip/Postal Code',
453453
'input' => 'text',
454454
'sort_order' => 110,
455-
'validate_rules' => 'a:0:{}',
455+
'validate_rules' => '[]',
456456
'data' => \Magento\Customer\Model\Attribute\Data\Postcode::class,
457457
'position' => 110,
458458
'required' => false,
@@ -462,7 +462,7 @@ public function getDefaultEntities()
462462
'label' => 'Phone Number',
463463
'input' => 'text',
464464
'sort_order' => 120,
465-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
465+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
466466
'position' => 120,
467467
],
468468
'fax' => [
@@ -471,7 +471,7 @@ public function getDefaultEntities()
471471
'input' => 'text',
472472
'required' => false,
473473
'sort_order' => 130,
474-
'validate_rules' => 'a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}',
474+
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
475475
'position' => 130,
476476
],
477477
],

app/code/Magento/SalesRule/Test/Unit/Model/_files/quote_item_downloadable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
'weee_tax_row_disposition' => '0.0000',
5555
'base_weee_tax_disposition' => '0.0000',
5656
'base_weee_tax_row_disposition' => '0.0000',
57-
'weee_tax_applied' => 'a:0:{}',
57+
'weee_tax_applied' => '[]',
5858
'weee_tax_applied_amount' => '0.0000',
5959
'weee_tax_applied_row_amount' => '0.0000',
6060
'base_weee_tax_applied_amount' => '0.0000',

app/code/Magento/SalesRule/Test/Unit/Model/_files/quote_item_simple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
'weee_tax_row_disposition' => '0.0000',
5555
'base_weee_tax_disposition' => '0.0000',
5656
'base_weee_tax_row_disposition' => '0.0000',
57-
'weee_tax_applied' => 'a:0:{}',
57+
'weee_tax_applied' => '[]',
5858
'weee_tax_applied_amount' => '0.0000',
5959
'weee_tax_applied_row_amount' => '0.0000',
6060
'base_weee_tax_applied_amount' => '0.0000',

app/code/Magento/Widget/Test/Unit/Controller/Adminhtml/Widget/LoadOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function dtestExecuteWithException()
140140
public function testExecute()
141141
{
142142
$widgetType = 'Magento\SomeWidget';
143-
$conditionsEncoded = 'a:3:{s:5:"value";i:1;s:8:"operator";s:2:"==";s:9:"attribute";s:2:"id";}';
143+
$conditionsEncoded = 'encoded conditions';
144144
$conditionsDecoded = [
145145
'value' => 1,
146146
'operator' => '==',

dev/tests/static/testsuite/Magento/Test/Legacy/_files/restricted_classes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@
138138
'name' => 'Magento_Cms',
139139
'path' => 'Setup/ContentConverter.php'
140140
],
141+
[
142+
'type' => 'library',
143+
'name' => 'magento/framework',
144+
'path' => 'Unserialize/Test/Unit/UnserializeTest.php'
145+
],
141146
]
142147
],
143148
'ArrayObject' => [

lib/internal/Magento/Framework/Module/Test/Unit/Setup/_files/data_content_serialized.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
],
1515
],
1616
'$tableData' => [
17-
['field' => 'a:1:{s:5:"model";s:34:"catalogrule/rule_condition_combine";}'],
18-
['field' => 'a:1:{s:5:"model";s:16:"some random text";}'],
17+
['field' => '{"max_text_length":255,"min_text_length":1}'],
18+
['field' => '{"model":"some random text"}'],
1919
],
2020
'$expected' => [
2121
'updates' => [
2222
[
2323
'table' => 'table',
2424
'field' => 'field',
25-
'to' => 'a:1:{s:5:"model";s:48:"Magento\CatalogRule\Model\Rule\Condition\Combine";}',
26-
'from' => ['`field` = ?' => 'a:1:{s:5:"model";s:34:"catalogrule/rule_condition_combine";}'],
25+
'to' => '{"model":"Magento\\CatalogRule\\Model\\Rule\\Condition\\Combine"}',
26+
'from' => ['`field` = ?' => '{"model":"catalogrule\/rule_condition_combine"}'],
2727
],
2828
],
2929
'aliases_map' => [
3030
\Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_MODEL => [
31-
'catalogrule/rule_condition_combine' => \Magento\CatalogRule\Model\Rule\Condition\Combine::class,
31+
'catalogrule/rule_condition_combine' => 'Magento\CatalogRule\Model\Rule\Condition\Combine',
3232
],
3333
],
3434
]

lib/internal/Magento/Framework/ObjectManager/Test/Unit/_files/empty_definition_file

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/internal/Magento/Framework/ObjectManager/Test/Unit/_files/test_definition_file

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)