New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support serialized arrays inside serialized arrays #1234

Closed
pavelevap opened this Issue May 30, 2017 · 1 comment

Comments

Projects
3 participants
@pavelevap
Copy link
Contributor

pavelevap commented May 30, 2017

Plugin developers can use maybe_serialize() function for serialized (partly) data and serialized string will be serialized again.

Related problems:

  • Wrong display of these data.
  • Null bytes problems #1224
  • Definition of entities is not possible.

Example from WooCommerce: B05847D36D6248E2A76B4847462F0528.zip

[B05847D36D6248E2A76B4847462F0528]
session_key = "a3807f15df7875f0e1cf17deb140e6b5"
session_value = <<<serialized>>> <array>
session_value["cart"] = "a:1:{s:32:\"a5bfc9e07964f8dddeb95fc584cd965d\";a:9:{s:10:\"product_id\";i:37;s:12:\"variation_id\";i:0;s:9:\"variation\";a:0:{}s:8:\"quantity\";i:1;s:10:\"line_total\";d:99;s:13:\"line_subtotal\";d:99;s:8:\"line_tax\";d:0;s:17:\"line_subtotal_tax\";d:0;s:13:\"line_tax_data\";a:2:{s:5:\"total\";a:0:{}s:8:\"subtotal\";a:0:{}}}}"
session_value["applied_coupons"] = "a:0:{}"
session_value["coupon_discount_amounts"] = "a:0:{}"
session_value["coupon_discount_tax_amounts"] = "a:0:{}"
session_value["removed_cart_contents"] = "a:0:{}"
session_value["cart_contents_total"] = 99
session_value["total"] = 199
session_value["subtotal"] = 99
session_value["subtotal_ex_tax"] = 99
session_value["tax_total"] = 0
session_value["taxes"] = "a:0:{}"
session_value["shipping_taxes"] = "a:0:{}"
session_value["discount_cart"] = 0
session_value["discount_cart_tax"] = 0
session_value["shipping_total"] = 100
session_value["shipping_tax_total"] = 0
session_value["fee_total"] = 0
session_value["fees"] = "a:0:{}"
session_value["customer"] = "a:24:{s:8:\"postcode\";s:0:\"\";s:4:\"city\";s:0:\"\";s:9:\"address_1\";s:0:\"\";s:7:\"address\";s:0:\"\";s:9:\"address_2\";s:0:\"\";s:5:\"state\";s:0:\"\";s:7:\"country\";s:2:\"CZ\";s:17:\"shipping_postcode\";s:0:\"\";s:13:\"shipping_city\";s:0:\"\";s:18:\"shipping_address_1\";s:0:\"\";s:16:\"shipping_address\";s:0:\"\";s:18:\"shipping_address_2\";s:0:\"\";s:14:\"shipping_state\";s:0:\"\";s:16:\"shipping_country\";s:2:\"CZ\";s:13:\"is_vat_exempt\";b:0;s:19:\"calculated_shipping\";b:0;s:10:\"first_name\";s:0:\"\";s:9:\"last_name\";s:0:\"\";s:7:\"company\";s:0:\"\";s:5:\"phone\";s:0:\"\";s:5:\"email\";s:0:\"\";s:19:\"shipping_first_name\";s:0:\"\";s:18:\"shipping_last_name\";s:0:\"\";s:16:\"shipping_company\";s:0:\"\";}"
session_value["shipping_for_package_0"] = "a:2:{s:12:\"package_hash\";s:40:\"wc_ship_cfe00310e69096c3bde394205e46df0c\";s:5:\"rates\";a:3:{s:11:\"flat_rate:1\";O:16:\"WC_Shipping_Rate\":6:{s:2:\"id\";s:11:\"flat_rate:1\";s:5:\"label\";s:9:\"Flat rate\";s:4:\"cost\";s:6:\"100.00\";s:5:\"taxes\";a:0:{}s:9:\"method_id\";s:9:\"flat_rate\";s:27:\"

@pavelevap pavelevap added this to the 4.0 milestone May 30, 2017

@borekb

This comment has been minimized.

Copy link
Member

borekb commented May 30, 2017

👍

In the INI files, the serialized sections could be nested like this:

session_value = <<<serialized>>> <array>
session_value["total"] = 199
session_value["customer"] = <<<serialized>>> <array>
session_value["customer"]["id"] = 123
session_value["applied_coupons"] = ...

In schema.yml, there would need to be a new syntax extending the current one. Some possible formats:

session_value["customer"]->["id"]: user
session_value["$customer"]["id"]: user
session_value["customer"][$]["id"]: user
session_value["$customer"][<<<serialized>>>]["id"]: user

@JanVoracek JanVoracek self-assigned this Jun 6, 2017

@borekb borekb added this to In Progress in 4.0-beta Jun 6, 2017

@borekb borekb moved this from In Progress to Done in 4.0-beta Jun 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment