mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 22:45:02 +02:00
#6462, not a bug unless you run a version of PHP 5 that is less than 5.0.4...
git-svn-id: file:///svn/phpbb/trunk@6786 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d9f3aed704
commit
2e1eef2713
@ -3568,34 +3568,32 @@ class bitfield
|
||||
// Get the ($n / 8)th char
|
||||
$byte = $n >> 3;
|
||||
|
||||
if (!isset($this->data[$byte]))
|
||||
if (strlen($this->data) >= $byte + 1)
|
||||
{
|
||||
// Of course, if it doesn't exist then the result if FALSE
|
||||
return false;
|
||||
}
|
||||
|
||||
$c = $this->data[$byte];
|
||||
|
||||
// Lookup the ($n % 8)th bit of the byte
|
||||
$bit = 7 - ($n & 7);
|
||||
return (bool) (ord($c) & (1 << $bit));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function set($n)
|
||||
{
|
||||
$byte = $n >> 3;
|
||||
$bit = 7 - ($n & 7);
|
||||
|
||||
if (isset($this->data[$byte]))
|
||||
if (strlen($this->data) >= $byte + 1)
|
||||
{
|
||||
$this->data[$byte] = $this->data[$byte] | chr(1 << $bit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($byte - strlen($this->data) > 0)
|
||||
{
|
||||
$this->data .= str_repeat("\0", $byte - strlen($this->data));
|
||||
}
|
||||
$this->data .= chr(1 << $bit);
|
||||
}
|
||||
}
|
||||
@ -3604,14 +3602,12 @@ class bitfield
|
||||
{
|
||||
$byte = $n >> 3;
|
||||
|
||||
if (!isset($this->data[$byte]))
|
||||
if (strlen($this->data) >= $byte + 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$bit = 7 - ($n & 7);
|
||||
$this->data[$byte] = $this->data[$byte] &~ chr(1 << $bit);
|
||||
}
|
||||
}
|
||||
|
||||
function get_blob()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user