I had a real problem with SUPEE-8788 related to the decision to replace PHP's unserialize()
function with the new Unserialize_Parser
. The problem is that the Gene_Braintree payment extension sets NULL values in the additional_data array saved in the payment quote. This was causing the exception "Unsupported data type N" to be thrown at checkout.
Here's how I solved this:
- Added
const TYPE_NULL = 'N';
tolib/Unserialize/Parser.php
- Created a new class Unserialize_Reader_Null (full code below)
- Added a case to the switch statement in
lib/Unserialize/Reader/ArrValue.php
to check for my new TYPE_NULL character and instantiate a newUnserialize_Reader_Null()
if it is found
New file lib/Unserialize/Reader/Null.php
:
<?php
class Unserialize_Reader_Null
{
/**
* @var int
*/
protected $_status;
/**
* @var string|int
*/
protected $_value;
const READING_VALUE = 1;
/**
* @param string $char
* @param string $prevChar
* @return int|null
*/
public function read($char, $prevChar)
{
if ($char == Unserialize_Parser::TYPE_NULL) {
return null;
}
else if ($char == Unserialize_Parser::SYMBOL_SEMICOLON) {
return '';
}
}
}