PDOException (42000)
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20' at line 1 PDOException thrown with message "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20' at line 1" Stacktrace: #8 PDOException in /var/www/aikonia/html/library/controllers/Blurb.php:72 #7 PDOStatement:execute in /var/www/aikonia/html/library/controllers/Blurb.php:72 #6 library\controllers\Blurb:filter in /var/www/aikonia/html/library/views/Blurbs.php:32 #5 library\views\Blurbs:get in /var/www/aikonia/html/library/views/Blurbs.php:27 #4 library\views\Blurbs:author in /var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Route/Route.php:128 #3 Pecee\SimpleRouter\Route\Route:renderRoute in /var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php:389 #2 Pecee\SimpleRouter\Router:routeRequest in /var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php:322 #1 Pecee\SimpleRouter\Router:start in /var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php:63 #0 Pecee\SimpleRouter\SimpleRouter:start in /var/www/aikonia/html/index.php:104
Stack frames (9)
8
PDOException
/library/controllers/Blurb.php72
7
PDOStatement execute
/library/controllers/Blurb.php72
6
library\controllers\Blurb filter
/library/views/Blurbs.php32
5
library\views\Blurbs get
/library/views/Blurbs.php27
4
library\views\Blurbs author
/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Route/Route.php128
3
Pecee\SimpleRouter\Route\Route renderRoute
/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php389
2
Pecee\SimpleRouter\Router routeRequest
/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php322
1
Pecee\SimpleRouter\Router start
/vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php63
0
Pecee\SimpleRouter\SimpleRouter start
/index.php104
/var/www/aikonia/html/library/controllers/Blurb.php
                {
                    $where = field('writer')->notIn('andrew-david', 'david', 'alexandria');
                }
                else
                {
                    $where = field('writer')->eq($author);
                }
            }
            
            $query = $this->queryFactory->select()
                ->from("blurbs")
                ->where($where)
                ->offset(($page - 1) * $blurbsPerPage)
                ->limit($blurbsPerPage)
                ->orderBy('id', 'desc')
                ->compile();
            
            $statement = $this->pdo->prepare($query->sql());
            
            if(!$statement->execute($query->params()))
                throw new \Exception("Error fetching blurbs from database.");
            
            $blurbs = array();
            foreach($statement->fetchAll(\PDO::FETCH_CLASS, \library\models\Blurb::class) as $blurb)
            {
                $blurbs[] = \library\models\Blurb::cast($blurb);
            }
            
            return $blurbs;
        }
        
        public function getNav(string $author = '', int $page = 1):Nav
        {
            $blurbsPerPage = 20;
            $nav = new Nav();
            
            $nav->first = 1;
            $nav->previous = max(1, $page - 1);
            
            $where = field('id')->gt(0);
/var/www/aikonia/html/library/controllers/Blurb.php
                {
                    $where = field('writer')->notIn('andrew-david', 'david', 'alexandria');
                }
                else
                {
                    $where = field('writer')->eq($author);
                }
            }
            
            $query = $this->queryFactory->select()
                ->from("blurbs")
                ->where($where)
                ->offset(($page - 1) * $blurbsPerPage)
                ->limit($blurbsPerPage)
                ->orderBy('id', 'desc')
                ->compile();
            
            $statement = $this->pdo->prepare($query->sql());
            
            if(!$statement->execute($query->params()))
                throw new \Exception("Error fetching blurbs from database.");
            
            $blurbs = array();
            foreach($statement->fetchAll(\PDO::FETCH_CLASS, \library\models\Blurb::class) as $blurb)
            {
                $blurbs[] = \library\models\Blurb::cast($blurb);
            }
            
            return $blurbs;
        }
        
        public function getNav(string $author = '', int $page = 1):Nav
        {
            $blurbsPerPage = 20;
            $nav = new Nav();
            
            $nav->first = 1;
            $nav->previous = max(1, $page - 1);
            
            $where = field('id')->gt(0);
/var/www/aikonia/html/library/views/Blurbs.php
        
        function __construct(Engine $templates, Blurb $blurb)
        {
            $this->templates = $templates;
            $this->blurb = $blurb;
        }
        
        public function index(int $page = 1)
        {
            return $this->get('', $page);
        }
        
        public function author(string $author, int $page = 1)
        {
            return $this->get($author, $page);
        }
        
        public function get(string $author = '', int $page = 1)
        {
            $blurbs = $this->blurb->filter($author, $page);
            
            $this->templates->addGlobals([
                'subtitle' => 'Blurbs',
                'description' => 'Blurbs for Aikonia, an on-going fantasy adventure webcomic that updates every Monday.'
            ]);
            
            return $this->templates->render('blurbs', array('blurbs' => $blurbs, 'writer' => $author, 'nav' => $this->blurb->getNav($author, $page)));
        }
    }
/var/www/aikonia/html/library/views/Blurbs.php
    {
        /** @var Engine */
        private $templates;
        /** @var Blurb */
        private $blurb;
        
        function __construct(Engine $templates, Blurb $blurb)
        {
            $this->templates = $templates;
            $this->blurb = $blurb;
        }
        
        public function index(int $page = 1)
        {
            return $this->get('', $page);
        }
        
        public function author(string $author, int $page = 1)
        {
            return $this->get($author, $page);
        }
        
        public function get(string $author = '', int $page = 1)
        {
            $blurbs = $this->blurb->filter($author, $page);
            
            $this->templates->addGlobals([
                'subtitle' => 'Blurbs',
                'description' => 'Blurbs for Aikonia, an on-going fantasy adventure webcomic that updates every Monday.'
            ]);
            
            return $this->templates->render('blurbs', array('blurbs' => $blurbs, 'writer' => $author, 'nav' => $this->blurb->getNav($author, $page)));
        }
    }
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Route/Route.php
        $namespace = $this->getNamespace();
 
        $className = ($namespace !== null && $controller[0][0] !== '\\') ? $namespace . '\\' . $controller[0] : $controller[0];
 
        $router->debug('Loading class %s', $className);
        $class = $router->getClassLoader()->loadClass($className);
 
        if (\count($controller) === 1) {
            $controller[1] = '__invoke';
        }
 
        $method = $controller[1];
 
        if (method_exists($class, $method) === false) {
            throw new NotFoundHttpException(sprintf('Method "%s" does not exist in class "%s"', $method, $className), 404);
        }
 
        $router->debug('Executing callback');
 
        return \call_user_func_array([$class, $method], array_values($parameters));
    }
 
    protected function parseParameters($route, $url, $parameterRegex = null)
    {
        $regex = (strpos($route, $this->paramModifiers[0]) === false) ? null :
            sprintf(
                static::PARAMETERS_REGEX_FORMAT,
                $this->paramModifiers[0],
                $this->paramOptionalSymbol,
                $this->paramModifiers[1]
            );
 
        // Ensures that host names/domains will work with parameters
        $url = '/' . ltrim($url, '/');
        $urlRegex = '';
        $parameters = [];
 
        if ($regex === null || (bool)preg_match_all('/' . $regex . '/u', $route, $parameters) === false) {
            $urlRegex = preg_quote($route, '/');
        } else {
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php
 
                    $route->loadMiddleware($this->request, $this);
                    $route->addGetParametersModelToParameters($this->request);
                    $route->addFilesToParameters($this->request);
                    $route->addPostBodyToParameters($this->request);
 
                    $output = $this->handleRouteRewrite($key, $url);
                    if ($output !== null) {
                        return $output;
                    }
 
                    $methodNotAllowed = false;
 
                    $this->request->addLoadedRoute($route);
 
                    $this->fireEvents(EventHandler::EVENT_RENDER_ROUTE, [
                        'route' => $route,
                    ]);
 
                    $output = $route->renderRoute($this->request, $this);
                    if ($output !== null) {
                        return $output;
                    }
 
                    $output = $this->handleRouteRewrite($key, $url);
                    if ($output !== null) {
                        return $output;
                    }
                }
            }
        } catch (\Exception $e) {
            $this->handleException($e);
        }
 
        if ($methodNotAllowed === true) {
            $message = sprintf('Route "%s" or method "%s" not allowed.', $this->request->getUrl()->getPath(), $this->request->getMethod());
            $this->handleException(new NotFoundHttpException($message, 403));
        }
 
        if (\count($this->request->getLoadedRoutes()) === 0) {
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php
     * @throws \Exception
     */
    public function start(): ?string
    {
        $this->debug('Router starting');
 
        $this->fireEvents(EventHandler::EVENT_INIT);
 
        $this->loadRoutes();
 
        if ($this->csrfVerifier !== null) {
            $this->fireEvents(EventHandler::EVENT_RENDER_CSRF, [
                'csrfVerifier' => $this->csrfVerifier,
            ]);
 
            /* Verify csrf token for request */
            $this->csrfVerifier->handle($this->request);
        }
 
        $output = $this->routeRequest();
 
        $this->fireEvents(EventHandler::EVENT_LOAD, [
            'loadedRoutes' => $this->getRequest()->getLoadedRoutes(),
        ]);
 
        $this->debug('Routing complete');
 
        return $output;
    }
 
    /**
     * Routes the request
     *
     * @return string|null
     * @throws HttpException
     * @throws \Exception
     */
    public function routeRequest(): ?string
    {
        $this->debug('Routing request');
/var/www/aikonia/html/vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php
     */
    protected static $response;
 
    /**
     * Router instance
     * @var Router
     */
    protected static $router;
 
    /**
     * Start routing
     *
     * @throws \Pecee\SimpleRouter\Exceptions\NotFoundHttpException
     * @throws \Pecee\Http\Middleware\Exceptions\TokenMismatchException
     * @throws HttpException
     * @throws \Exception
     */
    public static function start(): void
    {
        echo static::router()->start();
    }
 
    /**
     * Start the routing an return array with debugging-information
     *
     * @return array
     */
    public static function startDebug(): array
    {
        $routerOutput = null;
 
        try {
            ob_start();
            static::router()->setDebugEnabled(true)->start();
            $routerOutput = ob_get_contents();
            ob_end_clean();
        } catch (\Exception $e) {
        }
 
        // Try to parse library version
/var/www/aikonia/html/index.php
        // ABOUT
        SimpleRouter::get('/about', 'About@index')->setName('about');
        SimpleRouter::get('/cast', 'About@index')->setName('about');
        
        // LINKS
        SimpleRouter::get('/links', 'Links@index')->setName('links');
    });
 
    // API
    SimpleRouter::group(['prefix' => '/api', 'namespace' => 'library\controllers'], function()
    {
        // PAGE
        SimpleRouter::post('/buffer/post', 'Page@post')->setName('postbuffer');
        SimpleRouter::post('/page/images', 'Page@getImages')->setName('getimages');
        
        // COMMENT
        SimpleRouter::post('/comment/post', 'Comment@post')->setName('postcomment');
    });
    
    SimpleRouter::start();
 

Environment & details:

empty
empty
empty
empty
empty
Key Value
USER www-data
HOME /var/www
PATH_TRANSLATED redirect:/index.php/blurbs/david/0/david/0
PATH_INFO /blurbs/david/0
SCRIPT_NAME /index.php
REQUEST_URI /blurbs/david/0
QUERY_STRING
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/2.0
GATEWAY_INTERFACE CGI/1.1
REDIRECT_URL /blurbs/david/0
REMOTE_PORT 32782
SCRIPT_FILENAME /var/www/aikonia/html/index.php
SERVER_ADMIN hello@aikoniacomic.com
CONTEXT_DOCUMENT_ROOT /var/www/aikonia/html
CONTEXT_PREFIX
REQUEST_SCHEME https
DOCUMENT_ROOT /var/www/aikonia/html
REMOTE_ADDR 44.205.2.188
SERVER_PORT 443
SERVER_ADDR 159.203.44.17
SERVER_NAME aikoniacomic.com
SERVER_SOFTWARE Apache/2.4.54 (Ubuntu)
SERVER_SIGNATURE <address>Apache/2.4.54 (Ubuntu) Server at aikoniacomic.com Port 443</address>
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
HTTP_HOST aikoniacomic.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
proxy-nokeepalive 1
SSL_TLS_SNI aikoniacomic.com
HTTPS on
H2_STREAM_TAG 21-3
H2_STREAM_ID 3
H2_PUSHED_ON
H2_PUSHED
H2_PUSH off
H2PUSH off
HTTP2 on
REDIRECT_STATUS 200
REDIRECT_SSL_TLS_SNI aikoniacomic.com
REDIRECT_HTTPS on
REDIRECT_H2_STREAM_TAG 21-3
REDIRECT_H2_STREAM_ID 3
REDIRECT_H2_PUSHED_ON
REDIRECT_H2_PUSHED
REDIRECT_H2_PUSH off
REDIRECT_H2PUSH off
REDIRECT_HTTP2 on
FCGI_ROLE RESPONDER
PHP_SELF /index.php/blurbs/david/0
REQUEST_TIME_FLOAT 1711722911.492
REQUEST_TIME 1711722911
empty
0. Whoops\Handler\PrettyPageHandler