Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0035549 | mantisbt | plug-ins | public | 2025-03-07 08:21 | 2026-04-07 11:38 |
| Reporter | raspopov | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | acknowledged | Resolution | open | ||
| Product Version | 2.27.1 | ||||
| Summary | 0035549: MantisGraph APPLICATION ERROR 401 with SQLite | ||||
| Description | When the
All other pages of MantisGraph work fine. This only happens on PHP 7.4, everything displays fine on PHP 8.3. | ||||
| Additional Information | Debug Log has the one additional event in the PHP 8.4 that is missing in the PHP 7.4 case:
Empty database, one project (id=1), no issues. Branch: master. | ||||
| Tags | No tags attached. | ||||
|
I'm not able to reproduce this on my dev box. Maybe it's caused by specific database settings ? What happens when you run the query against the database directly ? |
|
It does not actually say '0', but that FLOOR is an unknown identifier. PHP 7.4 comes with SQLite 3.31, which does not have the FLOOR function. By the way, is it mandatory to use this function in the MantisGraph plugin, or can we somehow get by without it? |
|
|
Well it would have been worth mentioning somewhere that you were using SQLite, which is not (yet at least - see 0010573) supported - I was assuming you were on MySQL...
It is not, really. The requirement is to get an integer value without rounding, so floor was the most logical choice when I refactored graph_api.php last year. I'm fine with using an alternative as long as we get the same results. And we're dealing with unix timestamps here, so only positive values.
I'm a bit surprised by this statement, because to my knowledge libsqlite3 is no longer bundled since 7.4, so PHP should use whatever version is installed on the system. According to the SQLite change log, built-in math functions should be available since 3.35.0, assuming it has been compiled with the appropriate flag as you pointed out (which is the case on Ubuntu and Windows). So we could also decide to require this minimum version (and make sure. |
|
Yes, indeed. I almost always use SQLite and I don't even notice it anymore.
I am using PHP For Windows which is available here: https://windows.php.net/download/ |
|
|
Upstream issue https://github.com/ADOdb/ADOdb/issues/1061 has been fixed and will be released with ADOdb 5.22.9 (no announced date yet). |
|
|
It seems that all new versions of PHP for Windows still come with a compiled SQLite that lacks the math option. -_- |
|
Mathematically not identical, but since we are only dealing with positive values (timestamps) here, that should not be an issue here. That said, the behavior of ROUND is sometimes unexpected, for example in MySQL
For example:
So I'm a bit concern, and think that this should be carefully tested. Especially considering that SQLITE support is at this stage an experimental thing that only you are using... Moreover, some DB's require a 2nd param for precision (e.g. for mssql |
|
|
Oh! That's an idea - let's use “CAST”. |
|
Hmmm. We're going to have SQL portability issues with that.
So CAST seems to perform rounding too (although not on all DBs), which was unexpected and means it's no different from using ROUND and gets us back to my earlier concern... |
|
|
In fact, in both of these expressions, the variable |
|
Integer division is an interesting idea, however not all DBs are doing it.
MySQL has So the solution might be to determine the operator to use based on the DB being used. |
|
|
SQLite supports ROUND(x,d); I think this is the most compatible option. PR updated. |
|
|
@raspopov I spent sometime today reviewing / testing sqlite and provided some suggestions. It would be good to keep a running list of what is remaining to enable merging - e.g. adodb dev-master dependency. I'm looking forward to this being merged. |
|
|
@vboctor, Thank you for your time. As I understand it, @mnewnham has joined the SQLite implementation for ADODb, and he has his own plans for the necessary SQLite functionality in the library. |
|
related to
child of
duplicate of