: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Wordfence\MmdbReader;
const TYPE_UTF8_STRING = 2;
const TYPE_CONTAINER = 12;
const TYPE_END_MARKER = 13;
const EXTENSION_OFFSET = 7;
const MAX_SINGLE_BYTE_SIZE = 28;
public function __construct($type, $size) {
public function getType() {
public function getTypeName() {
return self::mapTypeName($this->getType());
public function getSize() {
public function is($type) {
return $this->type === $type;
public static function consume($handle) {
$byte = $handle->readByte();
if ($type === self::TYPE_EXTENDED)
$type = $handle->readByte() + self::EXTENSION_OFFSET;
$size = $byte & self::SIZE_MASK;
if ($size > self::MAX_SINGLE_BYTE_SIZE) {
$bytes = $size - self::MAX_SINGLE_BYTE_SIZE;
$size += IntegerParser::parseUnsigned($handle, $bytes);
return new self($type, $size);
public static function mapTypeName($type) {
case self::TYPE_EXTENDED:
case self::TYPE_UTF8_STRING:
return 'TYPE_UTF8_STRING';
case self::TYPE_CONTAINER:
case self::TYPE_END_MARKER:
return 'TYPE_END_MARKER';
public function __toString() {
return sprintf('%s(%d) of size %d', $this->getTypeName(), $this->getType(), $this->getSize());