title: base64_decode truncates array causes unserialize to return false
body: <p>I am logging user actions on an online application. So, I have a rather large (but not that large) multidimentional array that I am storing into database.
  To do so, I am using base64 encode / decode and serialize / unserialize.</p>
  
  <p>Here is the method I use to serialize my array: </p>
  
  <pre><code>$this-&gt;detail = base64_encode(serialize($detailedInfo));
  </code></pre>
  
  <p>And here how I'm getting back the data:</p>
  
  <pre><code>$logDetail = unserialize(base64_decode($log-&gt;detail));
  </code></pre>
  
  <p>It happens that sometimes, unserialize returns false.</p>
  
  <p>I've debugged a little and it seams that when the array gets larger, base64 encode or decode truncates the data.
  Here's a dump of the result of base64_decode on a smaller array:</p>
  
  <pre><code>a:2:{s:8:"products";a:7:{i:15;a:5:{s:9:"idProduct";s:2:"15";s:3:"zuc";s:6:"110224";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:837;a:5:{s:9:"idProduct";s:3:"837";s:3:"zuc";s:6:"322713";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:2405;a:5:{s:9:"idProduct";s:4:"2405";s:3:"zuc";s:6:"849755";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:2433;a:5:{s:9:"idProduct";s:4:"2433";s:3:"zuc";s:6:"855839";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:2494;a:5:{s:9:"idProduct";s:4:"2494";s:3:"zuc";s:6:"921545";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:2625;a:5:{s:9:"idProduct";s:4:"2625";s:3:"zuc";s:6:"971694";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}i:2626;a:5:{s:9:"idProduct";s:4:"2626";s:3:"zuc";s:6:"971769";s:8:"oldValue";s:6:"15,000";s:5:"value";s:2:"17";s:9:"hoppValue";d:17;}}s:5:"dates";a:3:{s:4:"post";a:2:{s:7:"dtStart";a:1:{i:0;s:10:"06/06/2016";}s:5:"dtEnd";a:1:{i:0;s:10:"08/08/2016";}}s:4:"hopp";a:2:{s:7:"dtStart";a:1:{i:0;s:10:"2016-06-06";}s:5:"dtEnd";a:1:{i:0;s:10:"2016-08-08";}}s:5:"weeks";a:11:{i:0;a:2:{s:5:"first";s:10:"2016-06-06";s:4:"last";s:10:"2016-06-12";}i:1;a:2:{s:5:"first";s:10:"2016-06-13";s:4:"last";s:10:"2016-06-19";}i:2;a:2:{s:5:"first";s:10:"2016-06-20";s:4:"last";s:10:"2016-06-26";}i:3;a:2:{s:5:"first";s:10:"2016-06-27";s:4:"last";s:10:"2016-06-30";}i:4;a:2:{s:5:"first";s:10:"2016-07-01";s:4:"last";s:10:"2016-07-03";}i:5;a:2:{s:5:"first";s:10:"2016-07-04";s:4:"last";s:10:"2016-07-10";}i:6;a:2:{s:5:"first";s:10:"2016-07-11";s:4:"last";s:10:"2016-07-17";}i:7;a:2:{s:5:"first";s:10:"2016-07-18";s:4:"last";s:10:"2016-07-24";}i:8;a:2:{s:5:"first";s:10:"2016-07-25";s:4:"last";s:10:"2016-07-31";}i:9;a:2:{s:5:"first";s:10:"2016-08-01";s:4:"last";s:10:"2016-08-07";}i:10;a:2:{s:5:"first";s:10:"2016-08-08";s:4:"last";s:10:"2016-08-14";}}}}
  </code></pre>
  
  <p>Here unserialize works fine!</p>
  
  <p>When the array is larger it seams truncated (just end of string line due to body char number limit): </p>
  
  <pre><code>(...) a:5:{s:9:"idProduct";s:4:"2237";s:3:"zuc";s:6:"712854";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2267;a:5:{s:9:"idProduct";s:4:"2267";s:3:"zuc";s:6:"712954";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2285;a:5:{s:9:"idProduct";s:4:"2285";s:3:"zuc";s:6:"712975";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2287;a:5:{s:9:"idProduct";s:4:"2287";s:3:"zuc";s:6:"712979";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2312;a:5:{s:9:"idProduct";s:4:"2312";s:3:"zuc";s:6:"753212";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2317;a:5:{s:9:"idProduct";s:4:"2317";s:3:"zuc";s:6:"754455";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2324;a:5:{s:9:"idProduct";s:4:"2324";s:3:"zuc";s:6:"757439";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2336;a:5:{s:9:"idProduct";s:4:"2336";s:3:"zuc";s:6:"759302";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2338;a:4:{s:9:"idProduct";s:4:"2338";s:3:"zuc";s:6:"759302";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";}i:2343;a:5:{s:9:"idProduct";s:4:"2343";s:3:"zuc";s:6:"765495";s:8:"oldValue";s:6:"12,000";s:5:"value";s:2:"15";s:9:"hoppValue";d:15;}i:2351;a:5:{s:9:"idProduct";s:4:"2351";s:3:"zuc";s:6:
  </code></pre>
  
  <p>And then, unserialize returns false.</p>
  
  <p>Am I doing something wrong? Is there a limit on the size of the array to be encoded / decoded (didn't find any info anywhere)</p>
  
  <p>Here's an example of the logDetail array (a small example, that works):</p>
  
  <pre><code>    Array
  (
      [products] =&gt; Array
          (
              [15] =&gt; Array
                  (
                      [idProduct] =&gt; 15
                      [zuc] =&gt; 110224
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [837] =&gt; Array
                  (
                      [idProduct] =&gt; 837
                      [zuc] =&gt; 322713
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [2405] =&gt; Array
                  (
                      [idProduct] =&gt; 2405
                      [zuc] =&gt; 849755
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [2433] =&gt; Array
                  (
                      [idProduct] =&gt; 2433
                      [zuc] =&gt; 855839
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [2494] =&gt; Array
                  (
                      [idProduct] =&gt; 2494
                      [zuc] =&gt; 921545
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [2625] =&gt; Array
                  (
                      [idProduct] =&gt; 2625
                      [zuc] =&gt; 971694
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
              [2626] =&gt; Array
                  (
                      [idProduct] =&gt; 2626
                      [zuc] =&gt; 971769
                      [oldValue] =&gt; 17,000
                      [value] =&gt; 20
                      [hoppValue] =&gt; 20
                  )
  
          )
  
      [dates] =&gt; Array
          (
              [post] =&gt; Array
                  (
                      [dtStart] =&gt; Array
                          (
                              [0] =&gt; 06/06/2016
                          )
  
                      [dtEnd] =&gt; Array
                          (
                              [0] =&gt; 08/08/2016
                          )
  
                  )
  
              [hopp] =&gt; Array
                  (
                      [dtStart] =&gt; Array
                          (
                              [0] =&gt; 2016-06-06
                          )
  
                      [dtEnd] =&gt; Array
                          (
                              [0] =&gt; 2016-08-08
                          )
  
                  )
  
              [weeks] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [first] =&gt; 2016-06-06
                              [last] =&gt; 2016-06-12
                          )
  
                      [1] =&gt; Array
                          (
                              [first] =&gt; 2016-06-13
                              [last] =&gt; 2016-06-19
                          )
  
                      [2] =&gt; Array
                          (
                              [first] =&gt; 2016-06-20
                              [last] =&gt; 2016-06-26
                          )
  
                      [3] =&gt; Array
                          (
                              [first] =&gt; 2016-06-27
                              [last] =&gt; 2016-06-30
                          )
  
                      [4] =&gt; Array
                          (
                              [first] =&gt; 2016-07-01
                              [last] =&gt; 2016-07-03
                          )
  
                      [5] =&gt; Array
                          (
                              [first] =&gt; 2016-07-04
                              [last] =&gt; 2016-07-10
                          )
  
                      [6] =&gt; Array
                          (
                              [first] =&gt; 2016-07-11
                              [last] =&gt; 2016-07-17
                          )
  
                      [7] =&gt; Array
                          (
                              [first] =&gt; 2016-07-18
                              [last] =&gt; 2016-07-24
                          )
  
                      [8] =&gt; Array
                          (
                              [first] =&gt; 2016-07-25
                              [last] =&gt; 2016-07-31
                          )
  
                      [9] =&gt; Array
                          (
                              [first] =&gt; 2016-08-01
                              [last] =&gt; 2016-08-07
                          )
  
                      [10] =&gt; Array
                          (
                              [first] =&gt; 2016-08-08
                              [last] =&gt; 2016-08-14
                          )
  
                  )
  
          )
  
  )
  </code></pre>