Skip to content

Commit

Permalink
ARGGG. I spent 1 hour discovering where was the error!!
Browse files Browse the repository at this point in the history
Under PHP5 we must cast objects to arrays to use them in loops.
But what is really annoying is that, instead of return an error, PHP
returns the 1st element! This should close bug 2581.
(http://moodle.org/bugs/bug.php?op=show&bugid=2581)
  • Loading branch information
stronk7 committed Feb 18, 2005
1 parent cf2d0af commit 4f746d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mod/glossary/rate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if ($data = data_submitted("$CFG->wwwroot/mod/glossary/view.php")) { // form submitted

foreach ($data as $entry => $rating) {
foreach ((array)$data as $entry => $rating) {
if ($entry == "id") {
continue;
}
Expand All @@ -33,7 +33,7 @@
error("Could not update an old rating ($entry = $rating)");
}
}
} else if ($rating) {
} else if ($rating >= 0) {
unset($newrating);
$newrating->userid = $USER->id;
$newrating->time = time();
Expand Down

0 comments on commit 4f746d2

Please sign in to comment.