aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-12-21 04:50:38 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-12-21 04:50:38 +0000
commit2e1eef2713f7891ce9d78736ceae6d2faf93fc4b (patch)
treec73ed3cc0e45d581938b7bcc5720e4f013cf493b /phpBB/includes
parentd9f3aed7042a85d9553dc509182422326e23ec49 (diff)
downloadforums-2e1eef2713f7891ce9d78736ceae6d2faf93fc4b.tar
forums-2e1eef2713f7891ce9d78736ceae6d2faf93fc4b.tar.gz
forums-2e1eef2713f7891ce9d78736ceae6d2faf93fc4b.tar.bz2
forums-2e1eef2713f7891ce9d78736ceae6d2faf93fc4b.tar.xz
forums-2e1eef2713f7891ce9d78736ceae6d2faf93fc4b.zip
#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
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php32
1 files changed, 14 insertions, 18 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 04113fae06..ea05d969a2 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3568,17 +3568,18 @@ class bitfield
// Get the ($n / 8)th char
$byte = $n >> 3;
- if (!isset($this->data[$byte]))
+ if (strlen($this->data) >= $byte + 1)
+ {
+ $c = $this->data[$byte];
+
+ // Lookup the ($n % 8)th bit of the byte
+ $bit = 7 - ($n & 7);
+ return (bool) (ord($c) & (1 << $bit));
+ }
+ else
{
- // 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));
}
function set($n)
@@ -3586,16 +3587,13 @@ class bitfield
$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 .= str_repeat("\0", $byte - strlen($this->data));
$this->data .= chr(1 << $bit);
}
}
@@ -3604,13 +3602,11 @@ 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);
}
-
- $bit = 7 - ($n & 7);
- $this->data[$byte] = $this->data[$byte] &~ chr(1 << $bit);
}
function get_blob()