Skip to content

Commit 1e3ddda

Browse files
committed
insane ctype_digit issue when int between -128 and 255 is provided because php is made by lunatics
1 parent 88cb391 commit 1e3ddda

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

core/controllers/Metadata.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function recording_default_values_save()
231231
return [false, 'No default album provided.'];
232232
}
233233

234-
if ($coreFields['year'] === 'required' && ! ctype_digit($this->data['year'])) {
234+
if ($coreFields['year'] === 'required' && ! ctype_digit((string) $this->data['year'])) {
235235
//T No default year provided.
236236
return [false, 'No default year provided.'];
237237
}
@@ -271,12 +271,13 @@ public function recording_default_values_save()
271271
if (
272272
$field['type'] === 'select' &&
273273
(! in_array($value, $field['settings']->options) &&
274-
(! ctype_digit($value) || count($field['settings']->options) < intval($value) || intval($value) < 0))
274+
(! ctype_digit((string) $value) || count($field['settings']->options) < intval($value) || intval($value) < 0))
275275
) {
276276
return [false, 'Selected value not in allowed options for custom field `' . $field['name'] . '`'];
277277
}
278278

279-
if ($field['type'] === 'integer' && ! ctype_digit($value)) {
279+
if ($field['type'] === 'integer' && ! ctype_digit((string) $value)) {
280+
var_dump($value);
280281
return [false, 'Value for custom field `' . $field['name'] . '` must be an integer'];
281282
}
282283
}

0 commit comments

Comments
 (0)