Permalink
Browse files

MDL-28080 coding_exception for over-long placeholder names.

  • Loading branch information...
1 parent 15141ad commit a167057d58c89344ed4b3d8d1439787ca68cce1e @timhunt timhunt committed with stronk7 Jul 22, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/dml/moodle_database.php
@@ -727,6 +727,11 @@ public function fix_sql_params($sql, array $params=null) {
if (!array_key_exists($key, $params)) {
throw new dml_exception('missingkeyinsql', $key, '');
}
+ if (strlen($key) > 30) {
+ throw new coding_exception(
+ "Placeholder names must be 30 characters or shorter. '" .
+ $key . "' is too long.", $sql);
+ }
$finalparams[$key] = $params[$key];
}
if ($count != count($finalparams)) {

0 comments on commit a167057

Please sign in to comment.