Closed souptonuts closed 3 years ago
I-Librarian installed and runs perfectly on a Google compute instance.
The problem install is with an armbian installation on a Nanopineo single board system.
I enabled debug on ilibrarian.ini and the more verbose error message identifies this block of code from classes/security/validation.php as causing the error
/**
* Integer is in range.
*
* @param int|string $value
* @param int $min
* @param int $max
* @throws Exception
*
* The min and max integers are limited by PHP_INT_MIN and PHP_INT_MAX.
*/
public function intRange($value, int $min, int $max): void {
$result = filter_var(
$value,
FILTER_VALIDATE_INT,
[
'options' => [
'min_range' => max($min, PHP_INT_MIN),
'max_range' => min($max, PHP_INT_MAX)
]
]
);
if ($result === false) {
throw new Exception('provided number is out of valid range', $this->http_code);
I don't see anything problematic with the code. One possibility is that the PHP_INT_MIN
and/or PHP_INT_MAX
constants in the PHP version compiled for your platform are somehow wrong (e.g. they are 0 or null).
I thought the same thing but when I use a test php code snippet to echo the variables I get
PHP_INT_MIN -2147483648 PHP_INT_MAX 2147483647
This section of code was changed recently: PHP ARM bug fixes #48 https://github.com/mkucej/i-librarian-free/issues/48
I tried reverting back just the section below but it still gives the error
'min_range' => $min, 'max_range' => $max
What are $min and $max?
My ugly hack is to invert the logic for the exception and then I can display pdf files.
$result === false changed to $result === true
On Wed, Feb 17, 2021 at 3:05 PM Martin Kucej notifications@github.com wrote:
I don't see anything problematic with the code. One possibility is that the PHP_INT_MIN and/or PHP_INT_MAX constants in the PHP version compiled for your platform are somehow wrong (e.g. they are 0 or null).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mkucej/i-librarian-free/issues/53#issuecomment-780819544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXLZOX2NDQCXDTTCPWZS4TS7QORFANCNFSM4XT2ZGAA .
I think the issue might be in Librarian\Security\Validation::id()
:
public function id($value): void {
$this->num($value);
$this->intRange($value, 1, (int) pow(2, 31));
}
Perhaps a change to $this->intRange($value, 1, (int) pow(2, 30);
will help?
It worked. Thanks for the fix
I did a clean install of i-Librarian free on a Ubuntu bionic system running php8.0 and Apache. I can access the web interface and upload pdf files but any further actions (read or download) gives a pop-up message "Info Provided number is out of valid range."
I enabled error logging for php and apache but I don't get anything useful there. Perhaps this is an sqlite3 error? Any ideas on how to troubleshoot?
From info.php:
Apache Version | Apache/2.4.29 (Ubuntu) Apache API Version | 20120211 Server Administrator | webmaster@localhost Hostname:Port | ::1:80 User/Group | www-data(33)/33 Max Requests | Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts | Connection: 300 - Keep-Alive: 5 Virtual Server | Yes Server Root | /etc/apache2 Loaded Modules | core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php mod_reqtimeout mod_setenvif mod_status
SQLite3 support | enabled SQLite Library | 3.22.0 Directive | Local Value | Master Value sqlite3.extension_dir | no value | no value