title: PHP unserialized integer from 64-bit to 32-bit
body: <p>I have been trying to unserialize on a 32-bit server an object that was serialized on a 64-bit server. I have isolated my problem to an integer in the object. Here is a small reproduction of the problem.</p>
  
  <p>On a 64-bit machine:</p>
  
  <pre><code>$i = serialize('20110510134021'); //i:20110510134021;
  </code></pre>
  
  <p>On a 32-bit machine:</p>
  
  <pre><code>$i = unserialize('i:20110510134021;');
  </code></pre>
  
  <p>Gives the error</p>
  
  <pre><code>Notice: unserialize(): Error at offset 0 of 16 bytes
  </code></pre>
  
  <p>Now I understand that those serialization method shouldn't be used for cross system data transmition. However, we are merely trying to migrate the data to another system, not use it actively for transfers. This is a one time thing.</p>
  
  <p>I would think that this might be due to integer overflow, but even on the 32-bit server I can do something like</p>
  
  <pre><code>$i = 20110510134021;
  echo $i;
  </code></pre>
  
  <p>And it will work fine. I'm guessing PHP integer types scale to some double type or something like that. But why doesn't it do that when it unserializes?</p>
  
  <p>How can I unserialize those objects? If I can't, is there any way to convert them to something else? Finally, has anyone written a deserialize method in PHP itself? Or has details on the protocol? I could use that and have a custom case for those integers.</p>
  
  <p>Thanks.</p>
  
  <p><strong>Note:</strong> I do not have access to the original data, only the serialized result.</p>