Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -126,13 +126,19 @@ |
127 | 127 | * Clauses can be formatted as 'foo=bar' or array('foo' => 'bar'), |
128 | 128 | * the latter only works if the value is a constant (i.e. not another field) |
129 | 129 | * |
| 130 | + * If $value is an empty array, this function does nothing. |
| 131 | + * |
130 | 132 | * For example, array('foo=bar', 'baz' => 3, 'bla' => 'foo') translates |
131 | 133 | * to "foo=bar AND baz='3' AND bla='foo'" |
132 | 134 | * @param mixed $value String or array |
133 | 135 | */ |
134 | 136 | protected function addWhere($value) { |
135 | | - if (is_array($value)) |
136 | | - $this->where = array_merge($this->where, $value); |
| 137 | + if (is_array($value)) { |
| 138 | + // Sanity check: don't insert empty arrays, |
| 139 | + // Database::makeList() chokes on them |
| 140 | + if(!empty($value)) |
| 141 | + $this->where = array_merge($this->where, $value); |
| 142 | + } |
137 | 143 | else |
138 | 144 | $this->where[] = $value; |
139 | 145 | } |
— | — | @@ -157,7 +163,7 @@ |
158 | 164 | * @param string $value Value; ignored if nul; |
159 | 165 | */ |
160 | 166 | protected function addWhereFld($field, $value) { |
161 | | - if (!is_null($value)) |
| 167 | + if (!is_null($value) && !empty($value)) |
162 | 168 | $this->where[$field] = $value; |
163 | 169 | } |
164 | 170 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -311,6 +311,7 @@ |
312 | 312 | * (bug 15767) apfilterlanglinks returns duplicate results |
313 | 313 | * (bug 15845) Added pageid/fromid parameter to action=delete/move, making |
314 | 314 | manipulation of legacy pages with invalid titles possible |
| 315 | +* (bug 15881) Empty or invalid parameters cause database errors |
315 | 316 | |
316 | 317 | === Languages updated in 1.14 === |
317 | 318 | |