summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-14 15:22:04 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-14 15:22:04 +0000
commit6bad9d56685e46264eed297310b26dfcabd26410 (patch)
tree8c8277edd54ff2f685eb91a6634a10470c5ae9a9 /modules
parentd56af24c71d7a0c32cb491b31c1e5e3eaf850f6b (diff)
downloadbrdo-6bad9d56685e46264eed297310b26dfcabd26410.tar.gz
brdo-6bad9d56685e46264eed297310b26dfcabd26410.tar.bz2
Wrap foreach(explode()) in empty() check, so if empty items are found, the foreach will not bail out on the explode(). Identified in upgrade testing.
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.install19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 993e4bd1f..c0bd24b47 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2342,14 +2342,17 @@ function system_update_164() {
$result = db_query('SELECT nid, polled FROM {poll}');
while ($poll = db_fetch_object($result)) {
- foreach (explode(' ', $poll->polled) as $polled) {
- if ($polled[0] == '_') {
- // $polled is a user id
- db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $poll->nid, substr($polled, 1, -1));
- }
- else {
- // $polled is a host
- db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $poll->nid, $polled);
+ if (!empty($poll->polled)) {
+ foreach (explode(' ', $poll->polled) as $polled) {
+ if ($polled[0] == '_') {
+ // $polled is a user id
+ db_query('INSERT INTO {poll_votes} (nid, uid) VALUES (%d, %d)', $poll->nid, substr($polled,
+1, -1));
+ }
+ else {
+ // $polled is a host
+ db_query("INSERT INTO {poll_votes} (nid, hostname) VALUES (%d, '%s')", $poll->nid, $polled);
+ }
}
}
}