public function _offsetSet($offset, $value) { if ($value < 0) { $value += 0x10000; } parent::_offsetSet($offset, $value); }