Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL in create_page_browser fails with sqlite #305

Closed
Lem opened this issue Oct 9, 2019 · 0 comments
Closed

SQL in create_page_browser fails with sqlite #305

Lem opened this issue Oct 9, 2019 · 0 comments

Comments

@Lem
Copy link

Lem commented Oct 9, 2019

I'm running the lastest master and using sqlite. On visiting list-virtual.php the following error gets created.
Placing a var_dump in functions.inc.php to look at the $idxfield (line ~550) reveals that the variable got address, which of course can not be exploded into two elements. So $end can not be filled and the SQL query fails.

2019/10/09 21:16:22 [error] 27240#27240: *98004 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined offset: 1 in /var/www/postfixadmin/functions.inc.php on line 552
PHP message: Invalid query: SQLSTATE[HY000]: General error: 1 near "AS": syntax error caused by
            WITH idx AS (SELECT *  FROM alias  LEFT JOIN (  SELECT 1 as __is_mailbox, username as __mailbox_username  FROM mailbox WHERE username IS NOT NULL  AND  domain IN ('DOMAIN')  ) AS __mailbox ON __mailbox_username = address
  WHERE 1=1   AND  domain IN ('DOMAIN','DOMAIN2')   AND    ( domain='DOMAIN' AND __mailbox_username IS NULL )  ORDER BY address)
                SELECT  AS label, (SELECT (COUNT(*) - 1) FROM idx t1 WHERE t1. <= t2. ) AS row
                FROM idx t2
                WHERE (row % 10) IN (0,9) OR row = 19
PHP message: PHP Fatal error:  Uncaught Exception: DEBUG INFORMATION: SQLSTATE[HY000]: General error: 1 near "AS": syntax error<br/> Check your error_log for the failed
query in /var/www/postfixadmin/functions.inc.php:1740
Stack trace:
#0 /var/www/postfixadmin/functions.inc.php(1680): db_query('\n            WI...', Array)
#1 /var/www/postfixadmin/functions.inc.php(570): db_query_all('\n            WI...', Array)
#2 /var/www/postfixadmin/model/PFAHandler.php(707): create_page_browser('address', ' FROM alias  LE...')
#3 /var/www/postfixadmin/model/AliasHandler.php(365): PFAHandler->getPagebrowser(Array, Array)
#4 /var/www/postfixadmin/public/list-virtual.php(162): AliasHandler->getPagebrowser(Array, Array)
#5 {main}
  thrown in /var/www/postfixadmin/functions.inc.php on line 1740" while reading response header from upstream, client: IPv6, server: DOMAIN, request: "GET /list-virtual.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "DOMAIN", referrer: "https://DOMAIN/list.php?table=domain"
DavidGoodwin added a commit that referenced this issue Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants