Minterwute
New member
I've run into an issue developing an addon for XF 1.4.3.
Setting a non-empty associative array as the default value for a field of type TYPE_SERIALIZED (or TYPE_JSON) in a DataWriter will result in an error caused by an attempted read on index 0.
Steps to reproduce the issue:
Attempting a write operation that involves this field will produce the following error:
Undefined offset: 0 - library\XenForo\DataWriter.php:1681
Setting a non-empty associative array as the default value for a field of type TYPE_SERIALIZED (or TYPE_JSON) in a DataWriter will result in an error caused by an attempted read on index 0.
Steps to reproduce the issue:
- Add a field to a new or existing DataWriter, with TYPE_SERIALIZED.
- Assign the default value of the field to a non-empty associative array.
Code:
// Given fields is the array return by _getFields()
$fields['my_field'] = array(
'type' => self::TYPE_SERIALIZED,
'default' => array(
'foo' => 'bar'
)
);
Attempting a write operation that involves this field will produce the following error:
Undefined offset: 0 - library\XenForo\DataWriter.php:1681