Commit 360bdf6f authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-26 - Array and Object data-types also affected by conversion exception error

parent d0b17ecc
......@@ -40,6 +40,10 @@ class ArrayType extends Type
public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
$value = (is_resource($value)) ? stream_get_contents($value) : $value;
$val = unserialize($value);
if ($val === false) {
......
......@@ -21,6 +21,10 @@ class ObjectType extends Type
public function convertToPHPValue($value, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{
if ($value === null) {
return null;
}
$value = (is_resource($value)) ? stream_get_contents($value) : $value;
$val = unserialize($value);
if ($val === false) {
......
......@@ -46,4 +46,8 @@ class ArrayTest extends \Doctrine\Tests\DbalTestCase
$this->_type->convertToPHPValue('abcdefg', $this->_platform);
}
public function testNullConversion()
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
......@@ -44,4 +44,9 @@ class ObjectTest extends \Doctrine\Tests\DbalTestCase
$this->setExpectedException('Doctrine\DBAL\Types\ConversionException');
$this->_type->convertToPHPValue('abcdefg', $this->_platform);
}
public function testNullConversion()
{
$this->assertNull($this->_type->convertToPHPValue(null, $this->_platform));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment