Topic: db_pager.inc bug, sql with no "where" keyword error

File: includes/db_pager.inc

// parse the query

                $parts = preg_split('/\sFROM\s/si', $sql, 2);
                    if (count($parts) == 2) {
                        $this->select = $parts[0];
                        $sql = $parts[1];
                    } else {
                        if ($SysPrefs->go_debug)
                            display_error("Invalid sql input for db_pager");
                    }

// fixed

                               $parts = preg_split('/\sFROM\s/si', $sql, 2);
                    if (count($parts) == 2) {
                        $this->select = $parts[0];
                        $this->from = $parts[1];
                        $sql = $parts[1];
                        
                    } else {
                        if ($SysPrefs->go_debug)
                            display_error("Invalid sql input for db_pager");
                    }

Re: db_pager.inc bug, sql with no "where" keyword error

@joe: is this necessary?

Re: db_pager.inc bug, sql with no "where" keyword error

I will check, but @FreeMan, what is the difference between the current sentence and the fixed one?

Joe

Re: db_pager.inc bug, sql with no "where" keyword error

The inserted line in the proposed solution is:

$this->from = $parts[1];

There is no "else" in the current codebase nor thru from FA v2.2.1.
It is not there even in @FreeMan's  cloned repo as of 4 years ago.

Wonder which version of FA is being used.