Fixed long albums/photos ids for 32bit PHP versions #487

This commit is contained in:
Tobias Reich 2016-03-24 18:23:19 +01:00
parent 9c1bab29f1
commit c6d8b5f312
3 changed files with 6 additions and 5 deletions

View File

@ -93,7 +93,7 @@ final class Admin extends Access {
Validator::required(isset($_POST['title']), __METHOD__);
$album = new Album(null);
Response::json($album->add($_POST['title']));
Response::json($album->add($_POST['title']), JSON_NUMERIC_CHECK);
}

View File

@ -16,9 +16,9 @@ final class Response {
}
public static function json($str) {
public static function json($str, $options = 0) {
exit(json_encode($str));
exit(json_encode($str, $options));
}

View File

@ -8,8 +8,9 @@ function generateID() {
// Ensure that the id has a length of 14 chars
while(strlen($id)<14) $id .= 0;
// Return the integer value of the id
return intval($id);
// Return id as a string. Don't convert the id to an integer
// as 14 digits are too big for 32bit PHP versions.
return $id;
}