When I serialize an array consisting of 3-4 multidimensional arrays, everything happens to be normal, when I serialize from an array in which there are more than 6 multidimensional arrays, everything seems to be normal, but I cannot deserialize them. I give an example of the array that does not want to deserialize:

a:10:{ i:0;a:4:{ i:0;s:79:"Π‘ΡƒΠΏ ΠΎΠ²ΠΎΡ‰Π½ΠΎΠΉ с Ρ„Ρ€ΠΈΠΊΠ°Π΄Π΅Π»ΡŒΠΊΠ°ΠΌΠΈ ΠΈΠ· мяса ΠΊΡƒΡ€ΠΈΡ†Ρ‹";i:1;s:1:"8";i:2;i:400;i:3;s:2:"50"; } i:1;a:4:{ i:0;s:91:"Мясо 'Атаман' (свинина, ΠΏΠΎΠΌΠΈΠ΄ΠΎΡ€, Π»ΡƒΠΊ, сыр, чСсн, ΠΌ-Π·)";i:1;s:2:"11";i:2;i:902;i:3;s:2:"82"; } i:2;a:4:{ i:0;s:10:"Бамсы";i:1;s:1:"5";i:2;i:175;i:3;s:2:"35"; } i:3;a:4:{ i:0;s:14:"Π‘ΡƒΠ»ΠΎΡ‡ΠΊΠ°";i:1;s:1:"5";i:2;i:100;i:3;s:2:"20"; } i:4;a:4:{ i:0;s:27:"КисСль ягодный";i:1;s:1:"1";i:2;i:35;i:3;s:2:"35"; } i:5;a:4:{ i:0;s:22:"Π‘-Ρ‚ 'ΠœΠ°Π»ΠΈΠ±Ρƒ'";i:1;s:1:"7";i:2;i:294;i:3;s:2:"42"; } i:6;a:4:{ i:0;s:74:"ВвороТная Π·Π°ΠΏΠ΅ΠΊΠ°Π½ΠΊΠ° со сгущёным ΠΌΠΎΠ»ΠΎΠΊΠΎΠΌ";i:1;s:1:"5";i:2;i:210;i:3;s:2:"42"; } i:7;a:4:{ i:0;s:59:"Π‘ΡƒΠ»ΡŒΠΎΠ½ с ΠΊΡƒΡ€ΠΈΠ½Ρ‹ΠΌ мясом ΠΈ зСлСнью";i:1;s:1:"1";i:2;i:70;i:3;s:2:"70"; } i:8;a:4:{ i:0;s:13:"с рисом";i:1;s:1:"1";i:2;i:20;i:3;s:2:"20"; } i:9;a:4:{ i:0;s:28:"Босиска Π² тСстС";i:1;s:1:"1";i:2;i:40;i:3;s:2:"40"; } } 
  • 2
    Yes, this can not be. Throw code somewhere in your script! - Artem

1 answer 1

Perhaps this is because of single quotes in words.
Try serializing htmlspecialchars(serialize($array),ENT_QOUTES)
And when unserialize(htmlspecialchars_decode($serialize_array)) anserialization unserialize(htmlspecialchars_decode($serialize_array))

  • 3
    Have you been to htmlspecialchars last time an array of shoving? - Sh4dow
  • @ Sh4dow beat me :) - Artem
  • Agreed, changed the answer - Maksym Prus
  • At the same time, you can still encode in base64, and then decode it. Just in case. - ReinRaus
  • Thanks helped! - blud