Twig \ Error \ RuntimeError
An exception has been thrown during the rendering of a template ("Database error: [HY000]MySQL server has gone away").
Previous exceptions
  • Database error: [HY000]MySQL server has gone away (0)
Twig\Error\RuntimeError thrown with message "An exception has been thrown during the rendering of a template ("Database error: [HY000]MySQL server has gone away")." Stacktrace: #33 Twig\Error\RuntimeError in /var/www/technexus/views/blog/sidebar.twig:20 #32 RuntimeException in /var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php:527 #31 Divergence\IO\Database\MySQL:handleException in /var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php:1028 #30 Divergence\Models\ActiveRecord:handleException in /var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php:500 #29 call_user_func in /var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php:500 #28 Divergence\IO\Database\MySQL:handleException in /var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php:307 #27 Divergence\IO\Database\MySQL:query in /var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php:454 #26 Divergence\IO\Database\MySQL:oneRecord in /var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php:185 #25 Divergence\Models\Model:getRecordByWhere in /var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php:147 #24 Divergence\Models\Model:getRecordByField in /var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php:132 #23 Divergence\Models\Model:getByField in /var/www/technexus/vendor/divergence/divergence/src/Models/Relations.php:183 #22 technexus\Models\PostTags:_getRelationshipValue in /var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php:478 #21 Divergence\Models\ActiveRecord:getValue in /var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php:362 #20 Divergence\Models\ActiveRecord:__isset in /var/www/technexus/vendor/twig/twig/src/Extension/CoreExtension.php:1548 #19 twig_get_attribute in /var/www/technexus/vendor/twig/twig/src/Environment.php:361 #18 __TwigTemplate_58937196ae36aef6a5deecc60f18f6de:doDisplay in /var/www/technexus/vendor/twig/twig/src/Template.php:394 #17 Twig\Template:displayWithErrorHandling in /var/www/technexus/vendor/twig/twig/src/Template.php:367 #16 Twig\Template:display in /var/www/technexus/vendor/twig/twig/src/Environment.php:361 #15 __TwigTemplate_fb8f4c9117fb7a99912f7a280ff16e10:doDisplay in /var/www/technexus/vendor/twig/twig/src/Template.php:394 #14 Twig\Template:displayWithErrorHandling in /var/www/technexus/vendor/twig/twig/src/Template.php:367 #13 Twig\Template:display in /var/www/technexus/vendor/twig/twig/src/Environment.php:361 #12 __TwigTemplate_5a21b5f66ad3c48b5082e8adf74fe1ff:doDisplay in /var/www/technexus/vendor/twig/twig/src/Template.php:394 #11 Twig\Template:displayWithErrorHandling in /var/www/technexus/vendor/twig/twig/src/Template.php:367 #10 Twig\Template:display in /var/www/technexus/vendor/twig/twig/src/Template.php:379 #9 Twig\Template:render in /var/www/technexus/vendor/twig/twig/src/TemplateWrapper.php:40 #8 Twig\TemplateWrapper:render in /var/www/technexus/vendor/twig/twig/src/Environment.php:280 #7 Twig\Environment:render in /var/www/technexus/vendor/divergence/divergence/src/Responders/TwigBuilder.php:29 #6 Divergence\Responders\TwigBuilder:getBody in /var/www/technexus/vendor/divergence/divergence/src/Responders/Response.php:103 #5 Divergence\Responders\Response:__construct in /var/www/technexus/src/Controllers/Blog.php:323 #4 technexus\Controllers\Blog:topics in /var/www/technexus/src/Controllers/Blog.php:62 #3 technexus\Controllers\Blog:handle in /var/www/technexus/src/Controllers/Main.php:47 #2 technexus\Controllers\Main:handle in /var/www/technexus/src/App.php:123 #1 technexus\App:handleRequest in /var/www/technexus/bootstrap/router.php:10 #0 require in /var/www/technexus/public/index.php:4
Stack frames (34)
33
Twig\Error\RuntimeError
/views/blog/sidebar.twig20
32
RuntimeException
/vendor/divergence/divergence/src/IO/Database/MySQL.php527
31
Divergence\IO\Database\MySQL handleException
/vendor/divergence/divergence/src/Models/ActiveRecord.php1028
30
Divergence\Models\ActiveRecord handleException
/vendor/divergence/divergence/src/IO/Database/MySQL.php500
29
call_user_func
/vendor/divergence/divergence/src/IO/Database/MySQL.php500
28
Divergence\IO\Database\MySQL handleException
/vendor/divergence/divergence/src/IO/Database/MySQL.php307
27
Divergence\IO\Database\MySQL query
/vendor/divergence/divergence/src/IO/Database/MySQL.php454
26
Divergence\IO\Database\MySQL oneRecord
/vendor/divergence/divergence/src/Models/Getters.php185
25
Divergence\Models\Model getRecordByWhere
/vendor/divergence/divergence/src/Models/Getters.php147
24
Divergence\Models\Model getRecordByField
/vendor/divergence/divergence/src/Models/Getters.php132
23
Divergence\Models\Model getByField
/vendor/divergence/divergence/src/Models/Relations.php183
22
technexus\Models\PostTags _getRelationshipValue
/vendor/divergence/divergence/src/Models/ActiveRecord.php478
21
Divergence\Models\ActiveRecord getValue
/vendor/divergence/divergence/src/Models/ActiveRecord.php362
20
Divergence\Models\ActiveRecord __isset
/vendor/twig/twig/src/Extension/CoreExtension.php1548
19
twig_get_attribute
/vendor/twig/twig/src/Environment.php361
18
__TwigTemplate_58937196ae36aef6a5deecc60f18f6de doDisplay
/vendor/twig/twig/src/Template.php394
17
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php367
16
Twig\Template display
/vendor/twig/twig/src/Environment.php361
15
__TwigTemplate_fb8f4c9117fb7a99912f7a280ff16e10 doDisplay
/vendor/twig/twig/src/Template.php394
14
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php367
13
Twig\Template display
/vendor/twig/twig/src/Environment.php361
12
__TwigTemplate_5a21b5f66ad3c48b5082e8adf74fe1ff doDisplay
/vendor/twig/twig/src/Template.php394
11
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php367
10
Twig\Template display
/vendor/twig/twig/src/Template.php379
9
Twig\Template render
/vendor/twig/twig/src/TemplateWrapper.php40
8
Twig\TemplateWrapper render
/vendor/twig/twig/src/Environment.php280
7
Twig\Environment render
/vendor/divergence/divergence/src/Responders/TwigBuilder.php29
6
Divergence\Responders\TwigBuilder getBody
/vendor/divergence/divergence/src/Responders/Response.php103
5
Divergence\Responders\Response __construct
/src/Controllers/Blog.php323
4
technexus\Controllers\Blog topics
/src/Controllers/Blog.php62
3
technexus\Controllers\Blog handle
/src/Controllers/Main.php47
2
technexus\Controllers\Main handle
/src/App.php123
1
technexus\App handleRequest
/bootstrap/router.php10
0
require
/public/index.php4
/var/www/technexus/views/blog/sidebar.twig
<aside class="col-md-4 blog-sidebar">
  <div class="p-3 mb-3 bg-light rounded blog-sidebar-about">
    <h4 class="font-italic">About</h4>
    <p class="mb-0">I was playing with HTML, CSS, and JavaScript when IE6 was cutting edge browser technology. Since then I've learned a thing or two.</p>
    <p class="mb-0">Most of the things I write about here are really just references for myself and ways of collecting my thoughts on a topic. I do, however, hope what you find here is useful to you.</p>
  </div>
 
  <div class="p-3">
    <h4 class="font-italic">Source Code</h4>
    <ol class="list-unstyled mb-0">
      <li><a href="https://github.com/hparadiz/technexus">This Website</a></li>
      <li><a href="https://github.com/divergence/framework">Divergence Framework</a></li>
      <li><a href="https://github.com/hparadiz/henshin">NodeJS Slack Bot</a></li>
    </ol>
  </div>
  
  <div class="p-3">
      <h4 class="font-italic">Topics</h4>
      {% for Tag in Sidebar.Tags %}
          <a class="badge badge-secondary" href="/topics/{{Tag.Tag.Slug|url_encode}}">{{Tag.Tag.Tag}}</a>    
      {% endfor %}
    </ol>
  </div>
 
  <div class="p-3">
    <h4 class="font-italic">Elsewhere</h4>
    <ol class="list-unstyled">
      <li><a href="https://github.com/hparadiz">GitHub</a></li>
      <li><a href="http://www.linkedin.com/in/henryparadiz">LinkedIn</a></li>
      <li><a href="https://twitter.com/0xAkuKun">Twitter</a></li>
    </ol>
  </div>
 
  <div class="p-3">
    <h4 class="font-italic">Archives</h4>
    <ol class="list-unstyled mb-0">
      {% for Month in Sidebar.Months %}
          <li><a href="/{{Month.Year}}/{{'%02d'|format(Month.Month)}}/">{{Month.MonthName}} {{Month.Year}}</a></li>
      {% endfor %}
    </ol>
Arguments
  1. "An exception has been thrown during the rendering of a template ("Database error: [HY000]MySQL server has gone away")."
    
/var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php
        }
 
        // get error message
        $error = static::getConnection()->errorInfo();
        $message = $error[2];
 
        if (App::$App->Config['environment']=='dev') {
            /** @var \Whoops\Handler\PrettyPageHandler */
            $Handler = \Divergence\App::$App->whoops->popHandler();
 
            if ($Handler::class === \Whoops\Handler\PrettyPageHandler::class) {
                $Handler->addDataTable("Query Information", [
                    'Query'         =>    $query,
                    'Error'        =>    $message,
                    'ErrorCode'    =>    static::getConnection()->errorCode(),
                ]);
                \Divergence\App::$App->whoops->pushHandler($Handler);
            }
        }
        throw new \RuntimeException(sprintf("Database error: [%s]", static::getConnection()->errorCode()).$message);
    }
 
    /**
     * Formats a query with vsprintf if you pass an array and sprintf if you pass a string.
     *
     * @param string $query A database query.
     * @param array|string $parameters Parameter(s) for vsprintf (array) or sprintf (string)
     * @return string A formatted query.
     */
    protected static function preprocessQuery($query, $parameters = [])
    {
        if (is_array($parameters) && count($parameters)) {
            return vsprintf($query, $parameters);
        } else {
            if (isset($parameters)) {
                return sprintf($query, $parameters);
            } else {
                return $query;
            }
        }
Arguments
  1. "Database error: [HY000]MySQL server has gone away"
    
Exception message: Database error: [HY000]MySQL server has gone away
/var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php
            if (static::isVersioned()) {
                $CreateTable .= SQL::getCreateTable(static::$rootClass, true);
            }
 
            $Statement = $Connection->query($CreateTable);
 
            // check for errors
            $ErrorInfo = $Statement->errorInfo();
 
            // handle query error
            if ($ErrorInfo[0] != '00000') {
                self::handleException($query, $queryLog);
            }
 
            // clear buffer (required for the next query to work without running fetchAll first
            $Statement->closeCursor();
 
            return $Connection->query((string)$query); // now the query should finish with no error
        } else {
            return DB::handleException($e, $query, $queryLog);
        }
    }
 
    /**
     * Iterates through all static::$beforeSave and static::$afterSave in this class and any of it's parent classes.
     * Checks if they are callables and if they are adds them to static::$_classBeforeSave[] and static::$_classAfterSave[]
     *
     * @return void
     *
     * @uses static::$beforeSave
     * @uses static::$afterSave
     * @uses static::$_classBeforeSave
     * @uses static::$_classAfterSave
     */
    protected static function _defineEvents()
    {
        // run before save
        $className = get_called_class();
 
        // merge fields from first ancestor up
/var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php
        }
    }
 
    /**
     * Handles any errors that are thrown by PDO
     *
     * If App::$App->Config['environment'] is 'dev' this method will attempt to hook into whoops and provide it with information about this query.
     *
     * @throws \RuntimeException Database error!
     *
     * @param Exception $e
     * @param string $query The query which caused the error.
     * @param boolean|array $queryLog An array created by startQueryLog containing logging information about this query.
     * @param callable $errorHandler An array handler to use instead of this one. If you pass this in it will run first and return directly.
     * @return void|mixed If $errorHandler is set to a callable it will try to run it and return anything that it returns. Otherwise void
     */
    public static function handleException(Exception $e, $query = '', $queryLog = false, $errorHandler = null)
    {
        if (is_callable($errorHandler, false, $callable)) {
            return call_user_func($errorHandler, $e, $query, $queryLog);
        }
 
        // save queryLog
        if ($queryLog) {
            $error = static::getConnection()->errorInfo();
            $queryLog['error'] = $error[2];
            static::finishQueryLog($queryLog);
        }
 
        // get error message
        $error = static::getConnection()->errorInfo();
        $message = $error[2];
 
        if (App::$App->Config['environment']=='dev') {
            /** @var \Whoops\Handler\PrettyPageHandler */
            $Handler = \Divergence\App::$App->whoops->popHandler();
 
            if ($Handler::class === \Whoops\Handler\PrettyPageHandler::class) {
                $Handler->addDataTable("Query Information", [
                    'Query'         =>    $query,
/var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php
        }
    }
 
    /**
     * Handles any errors that are thrown by PDO
     *
     * If App::$App->Config['environment'] is 'dev' this method will attempt to hook into whoops and provide it with information about this query.
     *
     * @throws \RuntimeException Database error!
     *
     * @param Exception $e
     * @param string $query The query which caused the error.
     * @param boolean|array $queryLog An array created by startQueryLog containing logging information about this query.
     * @param callable $errorHandler An array handler to use instead of this one. If you pass this in it will run first and return directly.
     * @return void|mixed If $errorHandler is set to a callable it will try to run it and return anything that it returns. Otherwise void
     */
    public static function handleException(Exception $e, $query = '', $queryLog = false, $errorHandler = null)
    {
        if (is_callable($errorHandler, false, $callable)) {
            return call_user_func($errorHandler, $e, $query, $queryLog);
        }
 
        // save queryLog
        if ($queryLog) {
            $error = static::getConnection()->errorInfo();
            $queryLog['error'] = $error[2];
            static::finishQueryLog($queryLog);
        }
 
        // get error message
        $error = static::getConnection()->errorInfo();
        $message = $error[2];
 
        if (App::$App->Config['environment']=='dev') {
            /** @var \Whoops\Handler\PrettyPageHandler */
            $Handler = \Divergence\App::$App->whoops->popHandler();
 
            if ($Handler::class === \Whoops\Handler\PrettyPageHandler::class) {
                $Handler->addDataTable("Query Information", [
                    'Query'         =>    $query,
/var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php
     */
    public static function query($query, $parameters = [], $errorHandler = null)
    {
        $query = static::preprocessQuery($query, $parameters);
 
        // start query log
        $queryLog = static::startQueryLog($query);
 
        // execute query
        try {
            static::$LastStatement = $Statement = static::getConnection()->query($query);
            // finish query log
            static::finishQueryLog($queryLog);
 
            return $Statement;
        } catch (\Exception $e) {
            $ErrorInfo = $e->errorInfo;
            if ($ErrorInfo[0] != '00000') {
                // handledException should return a PDOStatement from a successful query so let's pass this up
                $handledException = static::handleException($e, $query, $queryLog, $errorHandler);
                if (is_a($handledException, \PDOStatement::class)) {
                    static::$LastStatement = $handledException;
                    // start query log
                    static::startQueryLog($query);
 
                    return $handledException;
                } else {
                    throw $e;
                }
            }
        }
    }
 
    /*
     *  Uses $tableKey instead of primaryKey (usually ID) as the PHP array index
     *      Only do this with unique indexed fields. This is a helper method for that exact situation.
     */
    /**
     * Runs a query and returns all results as an associative array with $tableKey as the index instead of auto assignment in order of appearance by PHP.
     *
/var/www/technexus/vendor/divergence/divergence/src/IO/Database/MySQL.php
 
        // return record
        return $record;
    }
 
 
    /**
     * Returns the first database record from a query.
     *
     * It is recommended that you LIMIT 1 any records you want out of this to avoid having the database doing any work.
     *
     * @param string $query A MySQL query
     * @param array|string $parameters Optional parameters for vsprintf (array) or sprintf (string) to use for formatting the query.
     * @param callable $errorHandler A callback that will run in the event of an error instead of static::handleError
     * @return array Result from query or an empty array if nothing found.
     */
    public static function oneRecord($query, $parameters = [], $errorHandler = null)
    {
        // preprocess and execute query
        $result = static::query($query, $parameters, $errorHandler);
 
        // get record
        $record = $result->fetch(PDO::FETCH_ASSOC);
 
        // return record
        return $record;
    }
 
    /**
     * Returns the first value of the first database record from a query.
     *
     * @param string $query A MySQL query
     * @param array|string $parameters Optional parameters for vsprintf (array) or sprintf (string) to use for formatting the query.
     * @param callable $errorHandler A callback that will run in the event of an error instead of static::handleError
     * @return string|false First field from the first record from a query or false if nothing found.
     */
    public static function oneValue($query, $parameters = [], $errorHandler = null)
    {
        // get the first record
        $record = static::oneRecord($query, $parameters, $errorHandler);
/var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php
     *
     * @param array|string $conditions If passed as a string a database Where clause. If an array of field/value pairs will convert to a series of `field`='value' conditions joined with an AND operator.
     * @param array|string $options Only takes 'order' option. A raw database string that will be inserted into the OR clause of the query or an array of field/direction pairs.
     * @return array<static>|null First database result.
     */
    public static function getRecordByWhere($conditions, $options = [])
    {
        if (!is_array($conditions)) {
            $conditions = [$conditions];
        }
 
        $options = Util::prepareOptions($options, [
            'order' => false,
        ]);
 
        // initialize conditions and order
        $conditions = static::_mapConditions($conditions);
        $order = $options['order'] ? static::_mapFieldOrder($options['order']) : [];
 
        return DB::oneRecord(
            (new Select())->setTable(static::$tableName)->where(join(') AND (', $conditions))->order($order ? join(',', $order) : '')->limit('1'),
            null,
            [static::class,'handleException']
        );
    }
 
    /**
     * Get the first result instantiated as a model from a simple select query you can provide.
     *
     * @param string $query Database query. The passed in string will be passed through vsprintf or sprintf with $params.
     * @param array|string $params If an array will be passed through vsprintf as the second parameter with the query as the first. If a string will be used with sprintf instead. If nothing provided you must provide your own query.
     * @return static|null Single model instantiated from the first database result
     */
    public static function getByQuery($query, $params = [])
    {
        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleException']));
    }
 
    /**
     * Get all models in the database by class name. This is a subclass utility method. Requires a Class field on the model.
/var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php
     * @return static|null
     */
    public static function getByField($field, $value, $cacheIndex = false)
    {
        $record = static::getRecordByField($field, $value, $cacheIndex);
 
        return static::instantiateRecord($record);
    }
 
    /**
     * Get record by field.
     *
     * @param string $field Field name
     * @param string $value Field value
     * @param boolean $cacheIndex Optional. If we should cache the result or not. Default is false.
     * @return array<static>|null First database result.
     */
    public static function getRecordByField($field, $value, $cacheIndex = false)
    {
        return static::getRecordByWhere([static::_cn($field) => DB::escape($value)], $cacheIndex);
    }
 
    /**
     * Get the first result instantiated as a model from a simple select query with a where clause you can provide.
     *
     * @param array|string $conditions If passed as a string a database Where clause. If an array of field/value pairs will convert to a series of `field`='value' conditions joined with an AND operator.
     * @param array|string $options Only takes 'order' option. A raw database string that will be inserted into the OR clause of the query or an array of field/direction pairs.
     * @return static|null Single model instantiated from the first database result
     */
    public static function getByWhere($conditions, $options = [])
    {
        $record = static::getRecordByWhere($conditions, $options);
 
        return static::instantiateRecord($record);
    }
 
    /**
     * Get the first result as an array from a simple select query with a where clause you can provide.
     *
     * @param array|string $conditions If passed as a string a database Where clause. If an array of field/value pairs will convert to a series of `field`='value' conditions joined with an AND operator.
/var/www/technexus/vendor/divergence/divergence/src/Models/Getters.php
     * @return static|null
     */
    public static function getByID($id)
    {
        $record = static::getRecordByField(static::$primaryKey ? static::$primaryKey : 'ID', $id, true);
 
        return static::instantiateRecord($record);
    }
 
    /**
     * Get model object by field.
     *
     * @param string $field Field name
     * @param string $value Field value
     * @param boolean $cacheIndex Optional. If we should cache the result or not. Default is false.
     * @return static|null
     */
    public static function getByField($field, $value, $cacheIndex = false)
    {
        $record = static::getRecordByField($field, $value, $cacheIndex);
 
        return static::instantiateRecord($record);
    }
 
    /**
     * Get record by field.
     *
     * @param string $field Field name
     * @param string $value Field value
     * @param boolean $cacheIndex Optional. If we should cache the result or not. Default is false.
     * @return array<static>|null First database result.
     */
    public static function getRecordByField($field, $value, $cacheIndex = false)
    {
        return static::getRecordByWhere([static::_cn($field) => DB::escape($value)], $cacheIndex);
    }
 
    /**
     * Get the first result instantiated as a model from a simple select query with a where clause you can provide.
     *
/var/www/technexus/vendor/divergence/divergence/src/Models/Relations.php
                $options['class'] = get_called_class();
            }
        }
 
        return $options;
    }
 
    /**
     * Retrieves given relationship's value
     * @param string $relationship Name of relationship
     * @return mixed value
     */
    protected function _getRelationshipValue($relationship)
    {
        if (!isset($this->_relatedObjects[$relationship])) {
            $rel = static::$_classRelationships[get_called_class()][$relationship];
 
            if ($rel['type'] == 'one-one') {
                if ($value = $this->_getFieldValue($rel['local'])) {
                    $this->_relatedObjects[$relationship] = $rel['class']::getByField($rel['foreign'], $value);
 
                    // hook relationship for invalidation
                    static::$_classFields[get_called_class()][$rel['local']]['relationships'][$relationship] = true;
                } else {
                    $this->_relatedObjects[$relationship] = null;
                }
            } elseif ($rel['type'] == 'one-many') {
                if (!empty($rel['indexField']) && !$rel['class']::fieldExists($rel['indexField'])) {
                    $rel['indexField'] = false;
                }
 
                $this->_relatedObjects[$relationship] = $rel['class']::getAllByWhere(
                    array_merge($rel['conditions'], [
                        $rel['foreign'] => $this->_getFieldValue($rel['local']),
                    ]),
                    [
                        'indexField' => $rel['indexField'],
                        'order' => $rel['order'],
                        'conditions' => $rel['conditions'],
                    ]
/var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php
 
            case 'validationErrors':
                return array_filter($this->_validationErrors);
 
            case 'data':
                return $this->getData();
 
            case 'originalValues':
                return $this->_originalValues;
 
            default:
                {
                    // handle field
                    if (static::fieldExists($name)) {
                        return $this->_getFieldValue($name);
                    }
                    // handle relationship
                    elseif (static::isRelational()) {
                        if (static::_relationshipExists($name)) {
                            return $this->_getRelationshipValue($name);
                        }
                    }
                    // default Handle to ID if not caught by fieldExists
                    elseif ($name == static::$handleField) {
                        return $this->_getFieldValue('ID');
                    }
                }
        }
        // undefined
        return null;
    }
 
    /**
     * Sets a value on this model.
     *
     * @param string $name
     * @param mixed $value
     * @return void|false False if the field does not exist. Void otherwise.
     */
    public function setValue($name, $value)
/var/www/technexus/vendor/divergence/divergence/src/Models/ActiveRecord.php
     * @param string $name Name of the magic field to set.
     * @param mixed $value Value to set.
     *
     * @return mixed The return of $this->setValue($name,$value)
     */
    public function __set($name, $value)
    {
        return $this->setValue($name, $value);
    }
 
    /**
     * Tests if a magic class attribute is set or not.
     *
     * @param string $name Name of the magic field to set.
     *
     * @return bool Returns true if a value was returned by $this->getValue($name), false otherwise.
     */
    public function __isset($name)
    {
        $value = $this->getValue($name);
        return isset($value);
    }
 
    /**
     * Gets the primary key field for his model.
     *
     * @return string ID by default or static::$primaryKey if it's set.
     */
    public static function getPrimaryKey()
    {
        return isset(static::$primaryKey) ? static::$primaryKey : 'ID';
    }
 
    /**
     * Gets the primary key value for his model.
     *
     * @return mixed The primary key value for this object.
     */
    public function getPrimaryKeyValue()
    {
/var/www/technexus/vendor/twig/twig/src/Extension/CoreExtension.php
        }
 
        if (null === $object) {
            $message = sprintf('Impossible to invoke a method ("%s") on a null variable.', $item);
        } elseif (\is_array($object)) {
            $message = sprintf('Impossible to invoke a method ("%s") on an array.', $item);
        } else {
            $message = sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s").', $item, \gettype($object), $object);
        }
 
        throw new RuntimeError($message, $lineno, $source);
    }
 
    if ($object instanceof Template) {
        throw new RuntimeError('Accessing \Twig\Template attributes is forbidden.', $lineno, $source);
    }
 
    // object property
    if (/* Template::METHOD_CALL */ 'method' !== $type) {
        if (isset($object->$item) || \array_key_exists((string) $item, (array) $object)) {
            if ($isDefinedTest) {
                return true;
            }
 
            if ($sandboxed) {
                $env->getExtension(SandboxExtension::class)->checkPropertyAllowed($object, $item, $lineno, $source);
            }
 
            return $object->$item;
        }
    }
 
    static $cache = [];
 
    $class = \get_class($object);
 
    // object method
    // precedence: getXxx() > isXxx() > hasXxx()
    if (!isset($cache[$class])) {
        $methods = get_class_methods($object);
/var/www/technexus/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        $this->extensionSet->initRuntime();
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
     * @param string $name     An optional name of the template to be used in error messages
/var/www/technexus/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/technexus/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/technexus/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        $this->extensionSet->initRuntime();
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
     * @param string $name     An optional name of the template to be used in error messages
/var/www/technexus/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/technexus/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/technexus/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        $this->extensionSet->initRuntime();
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
     * @param string $name     An optional name of the template to be used in error messages
/var/www/technexus/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/technexus/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/technexus/vendor/twig/twig/src/Template.php
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
/var/www/technexus/vendor/twig/twig/src/TemplateWrapper.php
    private $env;
    private $template;
 
    /**
     * This method is for internal use only and should never be called
     * directly (use Twig\Environment::load() instead).
     *
     * @internal
     */
    public function __construct(Environment $env, Template $template)
    {
        $this->env = $env;
        $this->template = $template;
    }
 
    public function render(array $context = []): string
    {
        // using func_get_args() allows to not expose the blocks argument
        // as it should only be used by internal code
        return $this->template->render($context, \func_get_args()[1] ?? []);
    }
 
    public function display(array $context = [])
    {
        // using func_get_args() allows to not expose the blocks argument
        // as it should only be used by internal code
        $this->template->display($context, \func_get_args()[1] ?? []);
    }
 
    public function hasBlock(string $name, array $context = []): bool
    {
        return $this->template->hasBlock($name, $context);
    }
 
    /**
     * @return string[] An array of defined template block names
     */
    public function getBlockNames(array $context = []): array
    {
        return $this->template->getBlockNames($context);
/var/www/technexus/vendor/twig/twig/src/Environment.php
     */
    public function getTemplateClass(string $name, int $index = null): string
    {
        $key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
 
        return $this->templateClassPrefix.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $key).(null === $index ? '' : '___'.$index);
    }
 
    /**
     * Renders a template.
     *
     * @param string|TemplateWrapper $name The template name
     *
     * @throws LoaderError  When the template cannot be found
     * @throws SyntaxError  When an error occurred during compilation
     * @throws RuntimeError When an error occurred during rendering
     */
    public function render($name, array $context = []): string
    {
        return $this->load($name)->render($context);
    }
 
    /**
     * Displays a template.
     *
     * @param string|TemplateWrapper $name The template name
     *
     * @throws LoaderError  When the template cannot be found
     * @throws SyntaxError  When an error occurred during compilation
     * @throws RuntimeError When an error occurred during rendering
     */
    public function display($name, array $context = []): void
    {
        $this->load($name)->display($context);
    }
 
    /**
     * Loads a template.
     *
     * @param string|TemplateWrapper $name The template name
/var/www/technexus/vendor/divergence/divergence/src/Responders/TwigBuilder.php
 
namespace Divergence\Responders;
 
use Divergence\App;
use Twig\Environment;
use GuzzleHttp\Psr7\Utils;
use Twig\Loader\FilesystemLoader;
use Psr\Http\Message\StreamInterface;
use Twig\Extension\StringLoaderExtension;
 
class TwigBuilder extends ResponseBuilder
{
    protected string $contentType = 'text/html; charset=utf-8';
 
    public function getBody(): StreamInterface
    {
        $loader = new FilesystemLoader([App::$App->ApplicationPath.'/views']);
        $env = new Environment($loader, ['strict_variables' => true]);
        $env->addExtension(new StringLoaderExtension());
        $output = $env->render($this->template, $this->data);
        return Utils::streamFor($output);
    }
}
 
/var/www/technexus/vendor/divergence/divergence/src/Responders/Response.php
        505 => 'HTTP Version not supported',
        506 => 'Variant Also Negotiates',
        507 => 'Insufficient Storage',
        508 => 'Loop Detected',
        510 => 'Not Extended',
        511 => 'Network Authentication Required',
    ];
 
    /** @var string */
    private $reasonPhrase;
 
    /** @var int */
    private $statusCode;
 
    public function __construct(ResponseBuilder $responseBuilder)
    {
        $this
        ->withDefaults(200, [
            'Content-Type' => $responseBuilder->getContentType(),
        ], $responseBuilder->getBody());
    }
 
    /**
     * @param int                                  $status  Status code
     * @param array<string, string|string[]>       $headers Response headers
     * @param string|resource|StreamInterface|null $body    Response body
     * @param string                               $version Protocol version
     * @param string|null                          $reason  Reason phrase (when empty a default will be used based on the status code)
     * @return static
     */
    public function withDefaults(
        int $status = 200,
        array $headers = [],
        $body = null,
        string $version = '1.1',
        string $reason = null
    ) {
        $this->assertStatusCodeRange($status);
 
        $this->statusCode = $status;
/var/www/technexus/src/Controllers/Blog.php
        if ($this->peekPath()) {
            if (App::$App->is_loggedin()) {
                $where = "`Status` IN ('Draft','Published')";
            } else {
                $where = "`Status` IN ('Published')";
            }
            if ($Tag = \technexus\Models\Tag::getByField('Slug', urldecode($this->shiftPath()))) {
                $BlogPosts = BlogPost::getAllByQuery(
                    "SELECT SQL_CALC_FOUND_ROWS `bp`.* FROM `%s` `bp`
                    INNER JOIN %s as `t` ON `t`.`BlogPostID`=`bp`.`ID`
                    WHERE `t`.`TagID`='%s' AND $where
                    ORDER BY `Created` DESC",
                    [
                        BlogPost::$tableName,
                        PostTags::$tableName,
                        $Tag->ID,
                    ]
                );
                    
                return new Response(new TwigBuilder('blog/posts.twig', [
                    'Title' => $Tag->Tag,
                    'BlogPosts' => $BlogPosts,
                    'isLoggedIn' => App::$App->is_loggedin(),
                    'Sidebar' => $this->getSidebarData(),
                    'Limit' => static::LIMIT,
                    'Total' => DB::foundRows(),
                ]));
            }
        }
        return $this->notFound();
    }
    
    /**
     * Removes the user from the session and redirects to the homepage.
     *
     * @return void
     */
    public static function logout()
    {
        if (App::$App->Session->CreatorID) {
/var/www/technexus/src/Controllers/Blog.php
                return (new Admin())->handle($request);
                
            case 'api':
                return (new API())->handle($request);
 
            case 'media':
                return (new Media())->handle($request);
                
            case 'logout':
                return $this->logout();
 
            case '.rss':
                    return (new RSS())->handle($request);
                    
            case '':
                return $this->home($request);
                break;
 
            case 'topics':
                return $this->topics();
 
            case ctype_digit($action):
                // year of posts
                if (strlen($action) == 4) {
                    $year = $action;
                }
                // month of posts
                if (ctype_digit($this->peekPath()) && strlen($this->peekPath()) == 2) {
                    $month = $this->shiftPath();
                }
                // single post
                $permalink = $this->peekPath()?$this->shiftPath():null;
                
                // yearly digest
                if (empty($permalink) && empty($month)) {
                    return $this->year($year);
                }
                
                // monthly digest
                if (empty($permalink)) {
/var/www/technexus/src/Controllers/Main.php
     * @uses Blog::handleRequest()
     * @return void
     */
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (file_exists($_SERVER['DOCUMENT_ROOT'].'/site.LOCK')) {
            echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/down.html');
            exit;
        }
 
        /*
         * This is to make sure any page that loads
         * through Apache's ErrorDocument returns 200
         * instead of 404.
         */
        header('HTTP/1.0 200 OK');
        //header('X-Powered-By: PHP/' . phpversion() . ' Div Framework (http://emr.ge) Henry\'s Revision');
 
        $blog = new Blog();
        return $blog->handle($request);
    }
}
 
/var/www/technexus/src/App.php
                return true;
            }
        }
        return false;
    }
    
    /**
     * Gets difference between process start and now in microseconds.
     *
     * @return void
     */
    public function getLoadTime()
    {
        return (microtime(true)-DIVERGENCE_START);
    }
 
    public function handleRequest()
    {
        $main = new Main();
        $response = $main->handle(ServerRequest::fromGlobals());
        (new Emitter($response))->emit();
    }
}
 
/var/www/technexus/bootstrap/router.php
<?php
/**
 * This file is part of the Divergence package.
 *
 * (c) Henry Paradiz <henry.paradiz@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
$app->handleRequest();
 
/var/www/technexus/public/index.php
<?php
require(__DIR__.'/../bootstrap/autoload.php');
require(__DIR__.'/../bootstrap/app.php');
require(__DIR__.'/../bootstrap/router.php');
 
Arguments
  1. "/var/www/technexus/bootstrap/router.php"
    

Environment & details:

Key Value
Query
Divergence\IO\Database\Query\Select {#507}
Error
"MySQL server has gone away"
ErrorCode
"HY000"
empty
empty
empty
empty
empty
Key Value
USER
"www-data"
HOME
"/var/www"
HTTP_CONNECTION
"Keep-Alive"
HTTP_HOST
"technex.us"
HTTP_ACCEPT_ENCODING
"br,gzip"
HTTP_IF_MODIFIED_SINCE
"Thu, 30 Mar 2023 04:41:50 GMT"
HTTP_ACCEPT_LANGUAGE
"en-US,en;q=0.5"
HTTP_ACCEPT
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_USER_AGENT
"CCBot/2.0 (https://commoncrawl.org/faq/)"
PHP_VALUE
"""
upload_max_filesize = 20M \n
 post_max_size=21M
"""
SCRIPT_FILENAME
"/var/www/technexus/public/index.php"
REDIRECT_STATUS
"200"
SERVER_NAME
"technex.us"
SERVER_PORT
"443"
SERVER_ADDR
"192.241.147.251"
REMOTE_PORT
"56566"
REMOTE_ADDR
"3.236.237.61"
SERVER_SOFTWARE
"nginx/1.18.0"
GATEWAY_INTERFACE
"CGI/1.1"
HTTPS
"on"
REQUEST_SCHEME
"https"
SERVER_PROTOCOL
"HTTP/1.1"
DOCUMENT_ROOT
"/var/www/technexus/public"
DOCUMENT_URI
"/index.php"
REQUEST_URI
"/topics/oauth"
SCRIPT_NAME
"/index.php"
CONTENT_LENGTH
""
CONTENT_TYPE
""
REQUEST_METHOD
"GET"
QUERY_STRING
""
FCGI_ROLE
"RESPONDER"
PHP_SELF
"/index.php"
REQUEST_TIME_FLOAT
1696005503.2915
REQUEST_TIME
1696005503
empty
0. Whoops\Handler\PrettyPageHandler