Twig \ Error \ RuntimeError
An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT t0.name AS name_1, t0.body AS body_2, t0.status AS status_3, t0.settings AS settings_4, t0.styles AS styles_5, t0.id AS id_6, t0.created_at AS created_at_7, t0.updated_at AS updated_at_8, t0.deleted_at AS deleted_at_9 FROM ch_mailpoet_forms t0 WHERE t0.deleted_at IS NULL AND t0.status = ? ORDER BY t0.updated_at ASC' with params ["enabled"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away").
Previous exceptions
  • An exception occurred while executing 'SELECT t0.name AS name_1, t0.body AS body_2, t0.status AS status_3, t0.settings AS settings_4, t0.styles AS styles_5, t0.id AS id_6, t0.created_at AS created_at_7, t0.updated_at AS updated_at_8, t0.deleted_at AS deleted_at_9 FROM ch_mailpoet_forms t0 WHERE t0.deleted_at IS NULL AND t0.status = ? ORDER BY t0.updated_at ASC' with params ["enabled"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (0)
  • SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (HY000)
  • SQLSTATE[HY000]: General error: 2006 MySQL server has gone away (HY000)
Twig\Error\RuntimeError thrown with message "An exception has been thrown during the rendering of a template ("An exception occurred while executing 'SELECT t0.name AS name_1, t0.body AS body_2, t0.status AS status_3, t0.settings AS settings_4, t0.styles AS styles_5, t0.id AS id_6, t0.created_at AS created_at_7, t0.updated_at AS updated_at_8, t0.deleted_at AS deleted_at_9 FROM ch_mailpoet_forms t0 WHERE t0.deleted_at IS NULL AND t0.status = ? ORDER BY t0.updated_at ASC' with params ["enabled"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away")." Stacktrace: #43 Twig\Error\RuntimeError in /home/camphilltop/public_html/wp-content/themes/g5_helium/views/partials/content-page.html.twig:45 #42 MailPoetVendor\Doctrine\DBAL\Exception\ConnectionLost in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:2 #41 MailPoetVendor\Doctrine\DBAL\Driver\AbstractMySQLDriver:convertException in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:2 #40 MailPoetVendor\Doctrine\DBAL\DBALException:wrapException in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:2 #39 MailPoetVendor\Doctrine\DBAL\DBALException:driverExceptionDuringQuery in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:2 #38 MailPoetVendor\Doctrine\DBAL\Driver\PDO\Exception in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:2 #37 PDOException in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:2 #36 PDOStatement:execute in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:2 #35 MailPoetVendor\Doctrine\DBAL\Driver\PDOStatement:execute in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:2 #34 MailPoetVendor\Doctrine\DBAL\Connection:executeQuery in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php:2 #33 MailPoetVendor\Doctrine\ORM\Persisters\Entity\BasicEntityPersister:loadAll in /home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:2 #32 MailPoetVendor\Doctrine\ORM\EntityRepository:findBy in /home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Doctrine/Repository.php:44 #31 MailPoet\Doctrine\Repository:findBy in /home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Form/DisplayFormInWPContent.php:109 #30 MailPoet\Form\DisplayFormInWPContent:getForms in /home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Form/DisplayFormInWPContent.php:69 #29 MailPoet\Form\DisplayFormInWPContent:display in /home/camphilltop/public_html/wp-includes/class-wp-hook.php:303 #28 WP_Hook:apply_filters in /home/camphilltop/public_html/wp-includes/plugin.php:189 #27 apply_filters in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/timber/timber/lib/Post.php:1228 #26 Timber\Post:content in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:702 #25 Twig\Template:getAttribute in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/d4/d4372d09a5cf4d128edbb26ea931e145cd29ea1ae1e692fc472663ff9b36b1cd.php:148 #24 __TwigTemplate_2ba11a319440414388273a53cac8cedf36109d0b783d6020046f721c2596ba8d:block_content in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:216 #23 Twig\Template:displayBlock in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/d4/d4372d09a5cf4d128edbb26ea931e145cd29ea1ae1e692fc472663ff9b36b1cd.php:41 #22 __TwigTemplate_2ba11a319440414388273a53cac8cedf36109d0b783d6020046f721c2596ba8d:doDisplay in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:455 #21 Twig\Template:displayWithErrorHandling in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:422 #20 Twig\Template:display in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/b9/b9ae06a809c73f07e89efbe83083a70a8639e3bcfe225dbc1c1f7957f9b0b977.php:54 #19 __TwigTemplate_1ff3f2a5980379da920bace04426168694a7900db07797802b24c5ac5c9f0ec9:block_content in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:216 #18 Twig\Template:displayBlock in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/5e/5e51bf9cd643fe31ce286fc0b5c7efa4b7509bdb8106b304e5ab0fe6c750124f.php:55 #17 __TwigTemplate_11a0d6430a80e733d5fe2ce57630964405fd89071f131c9f0528cca5ca989c15:doDisplay in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:455 #16 Twig\Template:displayWithErrorHandling in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:422 #15 Twig\Template:display in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/c4/c45756a0cadb995b26733348d10baa40d123f19e7ab8afb81d74fa86646e7d30.php:36 #14 __TwigTemplate_5c802c7dc8a6d9195c841d1dd977cce49f22f3806ddcc3a304678eb8f3282c85:doDisplay in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:455 #13 Twig\Template:displayWithErrorHandling in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:422 #12 Twig\Template:display in /home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/b9/b9ae06a809c73f07e89efbe83083a70a8639e3bcfe225dbc1c1f7957f9b0b977.php:40 #11 __TwigTemplate_1ff3f2a5980379da920bace04426168694a7900db07797802b24c5ac5c9f0ec9:doDisplay in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:455 #10 Twig\Template:displayWithErrorHandling in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:422 #9 Twig\Template:display in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/Template.php:434 #8 Twig\Template:render in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/twig/twig/src/TemplateWrapper.php:47 #7 Twig\TemplateWrapper:render in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/timber/timber/lib/Loader.php:79 #6 Timber\Loader:render in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/timber/timber/lib/Timber.php:334 #5 Timber\Timber:compile in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/timber/timber/lib/Timber.php:383 #4 Timber\Timber:fetch in /home/camphilltop/public_html/wp-content/plugins/gantry5/src/vendor/timber/timber/lib/Timber.php:410 #3 Timber\Timber:render in /home/camphilltop/public_html/wp-content/themes/g5_helium/page.php:41 #2 include in /home/camphilltop/public_html/wp-includes/template-loader.php:106 #1 require_once in /home/camphilltop/public_html/wp-blog-header.php:19 #0 require in /home/camphilltop/public_html/index.php:17
Stack frames (44)
43
Twig\Error\RuntimeError
/home/camphilltop/public_html/wp-content/themes/g5_helium/views/partials/content-page.html.twig45
42
MailPoetVendor\Doctrine\DBAL\Exception\ConnectionLost
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php2
41
MailPoetVendor\Doctrine\DBAL\Driver\AbstractMySQLDriver convertException
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php2
40
MailPoetVendor\Doctrine\DBAL\DBALException wrapException
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php2
39
MailPoetVendor\Doctrine\DBAL\DBALException driverExceptionDuringQuery
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Connection.php2
38
MailPoetVendor\Doctrine\DBAL\Driver\PDO\Exception
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php2
37
PDOException
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php2
36
PDOStatement execute
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php2
35
MailPoetVendor\Doctrine\DBAL\Driver\PDOStatement execute
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Connection.php2
34
MailPoetVendor\Doctrine\DBAL\Connection executeQuery
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php2
33
MailPoetVendor\Doctrine\ORM\Persisters\Entity\BasicEntityPersister loadAll
/home/camphilltop/public_html/wp-content/plugins/mailpoet/vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php2
32
MailPoetVendor\Doctrine\ORM\EntityRepository findBy
/home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Doctrine/Repository.php44
31
MailPoet\Doctrine\Repository findBy
/home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Form/DisplayFormInWPContent.php109
30
MailPoet\Form\DisplayFormInWPContent getForms
/home/camphilltop/public_html/wp-content/plugins/mailpoet/lib/Form/DisplayFormInWPContent.php69
29
MailPoet\Form\DisplayFormInWPContent display
/home/camphilltop/public_html/wp-includes/class-wp-hook.php303
28
WP_Hook apply_filters
/home/camphilltop/public_html/wp-includes/plugin.php189
27
apply_filters
/vendor/timber/timber/lib/Post.php1228
26
Timber\Post content
/vendor/twig/twig/src/Template.php702
25
Twig\Template getAttribute
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/d4/d4372d09a5cf4d128edbb26ea931e145cd29ea1ae1e692fc472663ff9b36b1cd.php148
24
__TwigTemplate_2ba11a319440414388273a53cac8cedf36109d0b783d6020046f721c2596ba8d block_content
/vendor/twig/twig/src/Template.php216
23
Twig\Template displayBlock
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/d4/d4372d09a5cf4d128edbb26ea931e145cd29ea1ae1e692fc472663ff9b36b1cd.php41
22
__TwigTemplate_2ba11a319440414388273a53cac8cedf36109d0b783d6020046f721c2596ba8d doDisplay
/vendor/twig/twig/src/Template.php455
21
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php422
20
Twig\Template display
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/b9/b9ae06a809c73f07e89efbe83083a70a8639e3bcfe225dbc1c1f7957f9b0b977.php54
19
__TwigTemplate_1ff3f2a5980379da920bace04426168694a7900db07797802b24c5ac5c9f0ec9 block_content
/vendor/twig/twig/src/Template.php216
18
Twig\Template displayBlock
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/5e/5e51bf9cd643fe31ce286fc0b5c7efa4b7509bdb8106b304e5ab0fe6c750124f.php55
17
__TwigTemplate_11a0d6430a80e733d5fe2ce57630964405fd89071f131c9f0528cca5ca989c15 doDisplay
/vendor/twig/twig/src/Template.php455
16
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php422
15
Twig\Template display
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/c4/c45756a0cadb995b26733348d10baa40d123f19e7ab8afb81d74fa86646e7d30.php36
14
__TwigTemplate_5c802c7dc8a6d9195c841d1dd977cce49f22f3806ddcc3a304678eb8f3282c85 doDisplay
/vendor/twig/twig/src/Template.php455
13
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php422
12
Twig\Template display
/home/camphilltop/public_html/wp-content/cache/gantry5/g5_helium/twig/b9/b9ae06a809c73f07e89efbe83083a70a8639e3bcfe225dbc1c1f7957f9b0b977.php40
11
__TwigTemplate_1ff3f2a5980379da920bace04426168694a7900db07797802b24c5ac5c9f0ec9 doDisplay
/vendor/twig/twig/src/Template.php455
10
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php422
9
Twig\Template display
/vendor/twig/twig/src/Template.php434
8
Twig\Template render
/vendor/twig/twig/src/TemplateWrapper.php47
7
Twig\TemplateWrapper render
/vendor/timber/timber/lib/Loader.php79
6
Timber\Loader render
/vendor/timber/timber/lib/Timber.php334
5
Timber\Timber compile
/vendor/timber/timber/lib/Timber.php383
4
Timber\Timber fetch
/vendor/timber/timber/lib/Timber.php410
3
Timber\Timber render
/home/camphilltop/public_html/wp-content/themes/g5_helium/page.php41
2
include
/home/camphilltop/public_html/wp-includes/template-loader.php106
1
require_once
/home/camphilltop/public_html/wp-blog-header.php19
0
require
/home/camphilltop/public_html/index.php17
        </section>
        {# End Entry Header #}
 
        {# Check if page is password protected #}
        {% if not function( 'post_password_required', post.ID ) %}
 
            {# Begin Entry Content #}
            <section class="entry-content">
 
                {# Begin Featured Image #}
                {% if gantry.config.get('content.' ~ scope ~ '.featured-image.enabled', '1') and post.thumbnail.src %}
                    {% set position = (gantry.config.get('content.' ~ scope ~ '.featured-image.position', 'none') == 'none') ? '' : 'float-' ~ gantry.config.get('content.' ~ scope ~ '.featured-image.position', 'none') %}
                    <a href="{{ post.link }}" class="post-thumbnail" aria-hidden="true">
                        <img src="{{ post.thumbnail.src|resize(gantry.config.get('content.' ~ scope ~ '.featured-image.width', '1200'), gantry.config.get('content.' ~ scope ~ '.featured-image.height', '350')) }}" class="featured-image tease-featured-image {{ position }}" alt="{{ post.title }}" />
                    </a>
                {% endif %}
                {# End Featured Image #}
 
                {# Begin Page Content #}
                {{ post.content|raw }}
 
                {{ function('wp_link_pages', {'before': '<div class="page-links" itemprop="pagination">', 'after': '</div>', 'link_before': '<span class="page-number page-numbers">', 'link_after': '</span>', 'echo': 0}) }}
                {# End Page Content #}
 
                {# Begin Edit Link #}
                {{ function('edit_post_link', __('Edit', 'g5_helium'), '<span class="edit-link">', '</span>') }}
                {# End Edit Link #}
 
            </section>
            {# End Entry Content #}
 
        {% else %}
 
            {# Begin Password Protected Form #}
            <div class="password-form">
 
                {# Include the password form #}
                {% include 'partials/password-form.html.twig' %}
 
            </div>
<?php
 namespace MailPoetVendor\Doctrine\DBAL\Driver; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Connection; use MailPoetVendor\Doctrine\DBAL\Driver; use MailPoetVendor\Doctrine\DBAL\Driver\DriverException as DeprecatedDriverException; use MailPoetVendor\Doctrine\DBAL\Exception; use MailPoetVendor\Doctrine\DBAL\Exception\ConnectionException; use MailPoetVendor\Doctrine\DBAL\Exception\ConnectionLost; use MailPoetVendor\Doctrine\DBAL\Exception\DeadlockException; use MailPoetVendor\Doctrine\DBAL\Exception\DriverException; use MailPoetVendor\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; use MailPoetVendor\Doctrine\DBAL\Exception\InvalidFieldNameException; use MailPoetVendor\Doctrine\DBAL\Exception\LockWaitTimeoutException; use MailPoetVendor\Doctrine\DBAL\Exception\NonUniqueFieldNameException; use MailPoetVendor\Doctrine\DBAL\Exception\NotNullConstraintViolationException; use MailPoetVendor\Doctrine\DBAL\Exception\SyntaxErrorException; use MailPoetVendor\Doctrine\DBAL\Exception\TableExistsException; use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException; use MailPoetVendor\Doctrine\DBAL\Exception\UniqueConstraintViolationException; use MailPoetVendor\Doctrine\DBAL\Platforms\MariaDb1027Platform; use MailPoetVendor\Doctrine\DBAL\Platforms\MySQL57Platform; use MailPoetVendor\Doctrine\DBAL\Platforms\MySQL80Platform; use MailPoetVendor\Doctrine\DBAL\Platforms\MySqlPlatform; use MailPoetVendor\Doctrine\DBAL\Schema\MySqlSchemaManager; use MailPoetVendor\Doctrine\DBAL\VersionAwarePlatformDriver; use function assert; use function preg_match; use function stripos; use function version_compare; abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver { public function convertException($message, DeprecatedDriverException $exception) { switch ($exception->getErrorCode()) { case '1213': return new DeadlockException($message, $exception); case '1205': return new LockWaitTimeoutException($message, $exception); case '1050': return new TableExistsException($message, $exception); case '1051': case '1146': return new TableNotFoundException($message, $exception); case '1216': case '1217': case '1451': case '1452': case '1701': return new ForeignKeyConstraintViolationException($message, $exception); case '1062': case '1557': case '1569': case '1586': return new UniqueConstraintViolationException($message, $exception); case '1054': case '1166': case '1611': return new InvalidFieldNameException($message, $exception); case '1052': case '1060': case '1110': return new NonUniqueFieldNameException($message, $exception); case '1064': case '1149': case '1287': case '1341': case '1342': case '1343': case '1344': case '1382': case '1479': case '1541': case '1554': case '1626': return new SyntaxErrorException($message, $exception); case '1044': case '1045': case '1046': case '1049': case '1095': case '1142': case '1143': case '1227': case '1370': case '1429': case '2002': case '2005': return new ConnectionException($message, $exception); case '2006': return new ConnectionLost($message, $exception); case '1048': case '1121': case '1138': case '1171': case '1252': case '1263': case '1364': case '1566': return new NotNullConstraintViolationException($message, $exception); } return new DriverException($message, $exception); } public function createDatabasePlatformForVersion($version) { $mariadb = stripos($version, 'mariadb') !== \false; if ($mariadb && version_compare($this->getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) { return new MariaDb1027Platform(); } if (!$mariadb) { $oracleMysqlVersion = $this->getOracleMysqlVersionNumber($version); if (version_compare($oracleMysqlVersion, '8', '>=')) { return new MySQL80Platform(); } if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) { return new MySQL57Platform(); } } return $this->getDatabasePlatform(); } private function getOracleMysqlVersionNumber(string $versionString) : string { if (!preg_match('/^(?P<major>\\d+)(?:\\.(?P<minor>\\d+)(?:\\.(?P<patch>\\d+))?)?/', $versionString, $versionParts)) { throw Exception::invalidPlatformVersionSpecified($versionString, '<major_version>.<minor_version>.<patch_version>'); } $majorVersion = $versionParts['major']; $minorVersion = $versionParts['minor'] ?? 0; $patchVersion = $versionParts['patch'] ?? null; if ($majorVersion === '5' && $minorVersion === '7' && $patchVersion === null) { $patchVersion = '9'; } return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; } private function getMariaDbMysqlVersionNumber(string $versionString) : string { if (!preg_match('/^(?:5\\.5\\.5-)?(mariadb-)?(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)/i', $versionString, $versionParts)) { throw Exception::invalidPlatformVersionSpecified($versionString, '^(?:5\\.5\\.5-)?(mariadb-)?<major_version>.<minor_version>.<patch_version>'); } return $versionParts['major'] . '.' . $versionParts['minor'] . '.' . $versionParts['patch']; } public function getDatabase(Connection $conn) { $params = $conn->getParams(); if (isset($params['dbname'])) { return $params['dbname']; } $database = $conn->query('SELECT DATABASE()')->fetchColumn(); assert($database !== \false); return $database; } public function getDatabasePlatform() { return new MySqlPlatform(); } public function getSchemaManager(Connection $conn) { return new MySqlSchemaManager($conn); } } 
Exception message: An exception occurred while executing 'SELECT t0.name AS name_1, t0.body AS body_2, t0.status AS status_3, t0.settings AS settings_4, t0.styles AS styles_5, t0.id AS id_6, t0.created_at AS created_at_7, t0.updated_at AS updated_at_8, t0.deleted_at AS deleted_at_9 FROM ch_mailpoet_forms t0 WHERE t0.deleted_at IS NULL AND t0.status = ? ORDER BY t0.updated_at ASC' with params ["enabled"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
<?php
 namespace MailPoetVendor\Doctrine\DBAL; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Driver\DriverException as DeprecatedDriverException; use MailPoetVendor\Doctrine\DBAL\Driver\ExceptionConverterDriver; use MailPoetVendor\Doctrine\DBAL\Exception\DriverException; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Types\Type; use Throwable; use function array_map; use function bin2hex; use function get_class; use function gettype; use function implode; use function is_object; use function is_resource; use function is_string; use function json_encode; use function preg_replace; use function spl_object_hash; use function sprintf; class DBALException extends \Exception { public static function notSupported($method) { return new Exception(sprintf("Operation '%s' is not supported by platform.", $method)); } public static function invalidPlatformSpecified() : self { return new Exception("Invalid 'platform' option specified, need to give an instance of " . AbstractPlatform::class . '.'); } public static function invalidPlatformType($invalidPlatform) : self { if (is_object($invalidPlatform)) { return new Exception(sprintf("Option 'platform' must be a subtype of '%s', instance of '%s' given", AbstractPlatform::class, get_class($invalidPlatform))); } return new Exception(sprintf("Option 'platform' must be an object and subtype of '%s'. Got '%s'", AbstractPlatform::class, gettype($invalidPlatform))); } public static function invalidPlatformVersionSpecified($version, $expectedFormat) { return new Exception(sprintf('Invalid platform version "%s" specified. ' . 'The platform version has to be specified in the format: "%s".', $version, $expectedFormat)); } public static function invalidPdoInstance() { return new Exception("The 'pdo' option was used in DriverManager::getConnection() but no " . 'instance of PDO was given.'); } public static function driverRequired($url = null) { if ($url) { return new Exception(sprintf("The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " . 'is given to DriverManager::getConnection(). Given URL: %s', $url)); } return new Exception("The options 'driver' or 'driverClass' are mandatory if no PDO " . 'instance is given to DriverManager::getConnection().'); } public static function unknownDriver($unknownDriverName, array $knownDrivers) { return new Exception("The given 'driver' " . $unknownDriverName . ' is unknown, ' . 'Doctrine currently supports only the following drivers: ' . implode(', ', $knownDrivers)); } public static function driverExceptionDuringQuery(Driver $driver, Throwable $driverEx, $sql, array $params = []) { $msg = "An exception occurred while executing '" . $sql . "'"; if ($params) { $msg .= ' with params ' . self::formatParameters($params); } $msg .= ":\n\n" . $driverEx->getMessage(); return static::wrapException($driver, $driverEx, $msg); } public static function driverException(Driver $driver, Throwable $driverEx) { return static::wrapException($driver, $driverEx, 'An exception occurred in driver: ' . $driverEx->getMessage()); } private static function wrapException(Driver $driver, Throwable $driverEx, string $msg) { if ($driverEx instanceof DriverException) { return $driverEx; } if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DeprecatedDriverException) { return $driver->convertException($msg, $driverEx); } return new Exception($msg, 0, $driverEx); } private static function formatParameters(array $params) { return '[' . implode(', ', array_map(static function ($param) { if (is_resource($param)) { return (string) $param; } $json = @json_encode($param); if (!is_string($json) || $json === 'null' && is_string($param)) { return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param))); } return $json; }, $params)) . ']'; } public static function invalidWrapperClass($wrapperClass) { return new Exception("The given 'wrapperClass' " . $wrapperClass . ' has to be a ' . 'subtype of \\Doctrine\\DBAL\\Connection.'); } public static function invalidDriverClass($driverClass) { return new Exception("The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.'); } public static function invalidTableName($tableName) { return new Exception('Invalid table name specified: ' . $tableName); } public static function noColumnsSpecifiedForTable($tableName) { return new Exception('No columns specified for table ' . $tableName); } public static function limitOffsetInvalid() { return new Exception('Invalid Offset in Limit Query, it has to be larger than or equal to 0.'); } public static function typeExists($name) { return new Exception('Type ' . $name . ' already exists.'); } public static function unknownColumnType($name) { return new Exception('Unknown column type "' . $name . '" requested. Any Doctrine type that you use has ' . 'to be registered with \\Doctrine\\DBAL\\Types\\Type::addType(). You can get a list of all the ' . 'known types with \\Doctrine\\DBAL\\Types\\Type::getTypesMap(). If this error occurs during database ' . 'introspection then you might have forgotten to register all database types for a Doctrine Type. Use ' . 'AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' . 'Type#getMappedDatabaseTypes(). If the type name is empty you might ' . 'have a problem with the cache or forgot some mapping information.'); } public static function typeNotFound($name) { return new Exception('Type to be overwritten ' . $name . ' does not exist.'); } public static function typeNotRegistered(Type $type) : self { return new Exception(sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type))); } public static function typeAlreadyRegistered(Type $type) : self { return new Exception(sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type))); } } 
<?php
 namespace MailPoetVendor\Doctrine\DBAL; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Driver\DriverException as DeprecatedDriverException; use MailPoetVendor\Doctrine\DBAL\Driver\ExceptionConverterDriver; use MailPoetVendor\Doctrine\DBAL\Exception\DriverException; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Types\Type; use Throwable; use function array_map; use function bin2hex; use function get_class; use function gettype; use function implode; use function is_object; use function is_resource; use function is_string; use function json_encode; use function preg_replace; use function spl_object_hash; use function sprintf; class DBALException extends \Exception { public static function notSupported($method) { return new Exception(sprintf("Operation '%s' is not supported by platform.", $method)); } public static function invalidPlatformSpecified() : self { return new Exception("Invalid 'platform' option specified, need to give an instance of " . AbstractPlatform::class . '.'); } public static function invalidPlatformType($invalidPlatform) : self { if (is_object($invalidPlatform)) { return new Exception(sprintf("Option 'platform' must be a subtype of '%s', instance of '%s' given", AbstractPlatform::class, get_class($invalidPlatform))); } return new Exception(sprintf("Option 'platform' must be an object and subtype of '%s'. Got '%s'", AbstractPlatform::class, gettype($invalidPlatform))); } public static function invalidPlatformVersionSpecified($version, $expectedFormat) { return new Exception(sprintf('Invalid platform version "%s" specified. ' . 'The platform version has to be specified in the format: "%s".', $version, $expectedFormat)); } public static function invalidPdoInstance() { return new Exception("The 'pdo' option was used in DriverManager::getConnection() but no " . 'instance of PDO was given.'); } public static function driverRequired($url = null) { if ($url) { return new Exception(sprintf("The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " . 'is given to DriverManager::getConnection(). Given URL: %s', $url)); } return new Exception("The options 'driver' or 'driverClass' are mandatory if no PDO " . 'instance is given to DriverManager::getConnection().'); } public static function unknownDriver($unknownDriverName, array $knownDrivers) { return new Exception("The given 'driver' " . $unknownDriverName . ' is unknown, ' . 'Doctrine currently supports only the following drivers: ' . implode(', ', $knownDrivers)); } public static function driverExceptionDuringQuery(Driver $driver, Throwable $driverEx, $sql, array $params = []) { $msg = "An exception occurred while executing '" . $sql . "'"; if ($params) { $msg .= ' with params ' . self::formatParameters($params); } $msg .= ":\n\n" . $driverEx->getMessage(); return static::wrapException($driver, $driverEx, $msg); } public static function driverException(Driver $driver, Throwable $driverEx) { return static::wrapException($driver, $driverEx, 'An exception occurred in driver: ' . $driverEx->getMessage()); } private static function wrapException(Driver $driver, Throwable $driverEx, string $msg) { if ($driverEx instanceof DriverException) { return $driverEx; } if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DeprecatedDriverException) { return $driver->convertException($msg, $driverEx); } return new Exception($msg, 0, $driverEx); } private static function formatParameters(array $params) { return '[' . implode(', ', array_map(static function ($param) { if (is_resource($param)) { return (string) $param; } $json = @json_encode($param); if (!is_string($json) || $json === 'null' && is_string($param)) { return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param))); } return $json; }, $params)) . ']'; } public static function invalidWrapperClass($wrapperClass) { return new Exception("The given 'wrapperClass' " . $wrapperClass . ' has to be a ' . 'subtype of \\Doctrine\\DBAL\\Connection.'); } public static function invalidDriverClass($driverClass) { return new Exception("The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.'); } public static function invalidTableName($tableName) { return new Exception('Invalid table name specified: ' . $tableName); } public static function noColumnsSpecifiedForTable($tableName) { return new Exception('No columns specified for table ' . $tableName); } public static function limitOffsetInvalid() { return new Exception('Invalid Offset in Limit Query, it has to be larger than or equal to 0.'); } public static function typeExists($name) { return new Exception('Type ' . $name . ' already exists.'); } public static function unknownColumnType($name) { return new Exception('Unknown column type "' . $name . '" requested. Any Doctrine type that you use has ' . 'to be registered with \\Doctrine\\DBAL\\Types\\Type::addType(). You can get a list of all the ' . 'known types with \\Doctrine\\DBAL\\Types\\Type::getTypesMap(). If this error occurs during database ' . 'introspection then you might have forgotten to register all database types for a Doctrine Type. Use ' . 'AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' . 'Type#getMappedDatabaseTypes(). If the type name is empty you might ' . 'have a problem with the cache or forgot some mapping information.'); } public static function typeNotFound($name) { return new Exception('Type to be overwritten ' . $name . ' does not exist.'); } public static function typeNotRegistered(Type $type) : self { return new Exception(sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type))); } public static function typeAlreadyRegistered(Type $type) : self { return new Exception(sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type))); } } 
<?php
 namespace MailPoetVendor\Doctrine\DBAL; if (!defined('ABSPATH')) exit; use Closure; use MailPoetVendor\Doctrine\Common\EventManager; use MailPoetVendor\Doctrine\DBAL\Cache\ArrayStatement; use MailPoetVendor\Doctrine\DBAL\Cache\CacheException; use MailPoetVendor\Doctrine\DBAL\Cache\QueryCacheProfile; use MailPoetVendor\Doctrine\DBAL\Cache\ResultCacheStatement; use MailPoetVendor\Doctrine\DBAL\Driver\Connection as DriverConnection; use MailPoetVendor\Doctrine\DBAL\Driver\PingableConnection; use MailPoetVendor\Doctrine\DBAL\Driver\ResultStatement; use MailPoetVendor\Doctrine\DBAL\Driver\ServerInfoAwareConnection; use MailPoetVendor\Doctrine\DBAL\Exception\ConnectionLost; use MailPoetVendor\Doctrine\DBAL\Exception\InvalidArgumentException; use MailPoetVendor\Doctrine\DBAL\Exception\NoKeyValue; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Query\Expression\ExpressionBuilder; use MailPoetVendor\Doctrine\DBAL\Query\QueryBuilder; use MailPoetVendor\Doctrine\DBAL\Schema\AbstractSchemaManager; use MailPoetVendor\Doctrine\DBAL\Types\Type; use MailPoetVendor\Doctrine\Deprecations\Deprecation; use Throwable; use Traversable; use function array_key_exists; use function array_shift; use function assert; use function func_get_args; use function implode; use function is_int; use function is_string; use function key; class Connection implements DriverConnection { public const TRANSACTION_READ_UNCOMMITTED = TransactionIsolationLevel::READ_UNCOMMITTED; public const TRANSACTION_READ_COMMITTED = TransactionIsolationLevel::READ_COMMITTED; public const TRANSACTION_REPEATABLE_READ = TransactionIsolationLevel::REPEATABLE_READ; public const TRANSACTION_SERIALIZABLE = TransactionIsolationLevel::SERIALIZABLE; public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET; public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET; public const ARRAY_PARAM_OFFSET = 100; protected $_conn; protected $_config; protected $_eventManager; protected $_expr; private $autoCommit = \true; private $transactionNestingLevel = 0; private $transactionIsolationLevel; private $nestTransactionsWithSavepoints = \false; private $params; private $platform; protected $_schemaManager; protected $_driver; private $isRollbackOnly = \false; protected $defaultFetchMode = FetchMode::ASSOCIATIVE; public function __construct(array $params, Driver $driver, ?Configuration $config = null, ?EventManager $eventManager = null) { $this->_driver = $driver; $this->params = $params; if (isset($params['pdo'])) { $this->_conn = $params['pdo']; unset($this->params['pdo']); } if (isset($params['platform'])) { if (!$params['platform'] instanceof Platforms\AbstractPlatform) { throw Exception::invalidPlatformType($params['platform']); } $this->platform = $params['platform']; } if (!$config) { $config = new Configuration(); } if (!$eventManager) { $eventManager = new EventManager(); } $this->_config = $config; $this->_eventManager = $eventManager; $this->_expr = new Query\Expression\ExpressionBuilder($this); $this->autoCommit = $config->getAutoCommit(); } public function getParams() { return $this->params; } public function getDatabase() { return $this->_driver->getDatabase($this); } public function getHost() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getHost() is deprecated, get the database server host from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['host'] ?? null; } public function getPort() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getPort() is deprecated, get the database server port from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['port'] ?? null; } public function getUsername() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getUsername() is deprecated, get the username from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['user'] ?? null; } public function getPassword() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getPassword() is deprecated, get the password from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['password'] ?? null; } public function getDriver() { return $this->_driver; } public function getConfiguration() { return $this->_config; } public function getEventManager() { return $this->_eventManager; } public function getDatabasePlatform() { if ($this->platform === null) { $this->platform = $this->detectDatabasePlatform(); $this->platform->setEventManager($this->_eventManager); } return $this->platform; } public function getExpressionBuilder() { return $this->_expr; } public function connect() { if ($this->_conn !== null) { return \false; } $driverOptions = $this->params['driverOptions'] ?? []; $user = $this->params['user'] ?? null; $password = $this->params['password'] ?? null; $this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions); $this->transactionNestingLevel = 0; if ($this->autoCommit === \false) { $this->beginTransaction(); } if ($this->_eventManager->hasListeners(Events::postConnect)) { $eventArgs = new Event\ConnectionEventArgs($this); $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); } return \true; } private function detectDatabasePlatform() : AbstractPlatform { $version = $this->getDatabasePlatformVersion(); if ($version !== null) { assert($this->_driver instanceof VersionAwarePlatformDriver); return $this->_driver->createDatabasePlatformForVersion($version); } return $this->_driver->getDatabasePlatform(); } private function getDatabasePlatformVersion() { if (!$this->_driver instanceof VersionAwarePlatformDriver) { return null; } if (isset($this->params['serverVersion'])) { return $this->params['serverVersion']; } if ($this->_conn === null) { try { $this->connect(); } catch (Throwable $originalException) { if (empty($this->params['dbname'])) { throw $originalException; } $params = $this->params; unset($this->params['dbname']); try { $this->connect(); } catch (Throwable $fallbackException) { throw $originalException; } finally { $this->params = $params; } $serverVersion = $this->getServerVersion(); $this->close(); return $serverVersion; } } return $this->getServerVersion(); } private function getServerVersion() { $connection = $this->getWrappedConnection(); if ($connection instanceof ServerInfoAwareConnection && !$connection->requiresQueryForServerVersion()) { return $connection->getServerVersion(); } return null; } public function isAutoCommit() { return $this->autoCommit === \true; } public function setAutoCommit($autoCommit) { $autoCommit = (bool) $autoCommit; if ($autoCommit === $this->autoCommit) { return; } $this->autoCommit = $autoCommit; if ($this->_conn === null || $this->transactionNestingLevel === 0) { return; } $this->commitAll(); } public function setFetchMode($fetchMode) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Default Fetch Mode configuration is deprecated, use explicit Connection::fetch*() APIs instead.'); $this->defaultFetchMode = $fetchMode; } public function fetchAssoc($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchAssoc() is deprecated, use Connection::fetchAssociative() API instead.'); return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::ASSOCIATIVE); } public function fetchArray($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchArray() is deprecated, use Connection::fetchNumeric() API instead.'); return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::NUMERIC); } public function fetchColumn($sql, array $params = [], $column = 0, array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchColumn() is deprecated, use Connection::fetchOne() API instead.'); return $this->executeQuery($sql, $params, $types)->fetchColumn($column); } public function fetchAssociative(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchNumeric(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchOne(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchOne(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function isConnected() { return $this->_conn !== null; } public function isTransactionActive() { return $this->transactionNestingLevel > 0; } private function addCriteriaCondition(array $criteria, array &$columns, array &$values, array &$conditions) : void { $platform = $this->getDatabasePlatform(); foreach ($criteria as $columnName => $value) { if ($value === null) { $conditions[] = $platform->getIsNullExpression($columnName); continue; } $columns[] = $columnName; $values[] = $value; $conditions[] = $columnName . ' = ?'; } } public function delete($table, array $criteria, array $types = []) { if (empty($criteria)) { throw InvalidArgumentException::fromEmptyCriteria(); } $columns = $values = $conditions = []; $this->addCriteriaCondition($criteria, $columns, $values, $conditions); return $this->executeStatement('DELETE FROM ' . $table . ' WHERE ' . implode(' AND ', $conditions), $values, is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types); } public function close() { $this->_conn = null; } public function setTransactionIsolation($level) { $this->transactionIsolationLevel = $level; return $this->executeStatement($this->getDatabasePlatform()->getSetTransactionIsolationSQL($level)); } public function getTransactionIsolation() { if ($this->transactionIsolationLevel === null) { $this->transactionIsolationLevel = $this->getDatabasePlatform()->getDefaultTransactionIsolationLevel(); } return $this->transactionIsolationLevel; } public function update($table, array $data, array $criteria, array $types = []) { $columns = $values = $conditions = $set = []; foreach ($data as $columnName => $value) { $columns[] = $columnName; $values[] = $value; $set[] = $columnName . ' = ?'; } $this->addCriteriaCondition($criteria, $columns, $values, $conditions); if (is_string(key($types))) { $types = $this->extractTypeValues($columns, $types); } $sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $set) . ' WHERE ' . implode(' AND ', $conditions); return $this->executeStatement($sql, $values, $types); } public function insert($table, array $data, array $types = []) { if (empty($data)) { return $this->executeStatement('INSERT INTO ' . $table . ' () VALUES ()'); } $columns = []; $values = []; $set = []; foreach ($data as $columnName => $value) { $columns[] = $columnName; $values[] = $value; $set[] = '?'; } return $this->executeStatement('INSERT INTO ' . $table . ' (' . implode(', ', $columns) . ')' . ' VALUES (' . implode(', ', $set) . ')', $values, is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types); } private function extractTypeValues(array $columnList, array $types) { $typeValues = []; foreach ($columnList as $columnIndex => $columnName) { $typeValues[] = $types[$columnName] ?? ParameterType::STRING; } return $typeValues; } public function quoteIdentifier($str) { return $this->getDatabasePlatform()->quoteIdentifier($str); } public function quote($value, $type = ParameterType::STRING) { $connection = $this->getWrappedConnection(); [$value, $bindingType] = $this->getBindingInfo($value, $type); return $connection->quote($value, $bindingType); } public function fetchAll($sql, array $params = [], $types = []) { return $this->executeQuery($sql, $params, $types)->fetchAll(); } public function fetchAllNumeric(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAllNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchAllAssociative(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAllAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchAllKeyValue(string $query, array $params = [], array $types = []) : array { $stmt = $this->executeQuery($query, $params, $types); $this->ensureHasKeyValue($stmt); $data = []; foreach ($stmt->fetchAll(FetchMode::NUMERIC) as [$key, $value]) { $data[$key] = $value; } return $data; } public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []) : array { $stmt = $this->executeQuery($query, $params, $types); $data = []; foreach ($stmt->fetchAll(FetchMode::ASSOCIATIVE) as $row) { $data[array_shift($row)] = $row; } return $data; } public function fetchFirstColumn(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchFirstColumn(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateNumeric(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateAssociative(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateKeyValue(string $query, array $params = [], array $types = []) : Traversable { $stmt = $this->executeQuery($query, $params, $types); $this->ensureHasKeyValue($stmt); while (($row = $stmt->fetch(FetchMode::NUMERIC)) !== \false) { (yield $row[0] => $row[1]); } } public function iterateAssociativeIndexed(string $query, array $params = [], array $types = []) : Traversable { $stmt = $this->executeQuery($query, $params, $types); while (($row = $stmt->fetch(FetchMode::ASSOCIATIVE)) !== \false) { (yield array_shift($row) => $row); } } public function iterateColumn(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateColumn(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function prepare($sql) { try { $stmt = new Statement($sql, $this); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql); } $stmt->setFetchMode($this->defaultFetchMode); return $stmt; } public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null) { if ($qcp !== null) { return $this->executeCacheQuery($sql, $params, $types, $qcp); } $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql, $params, $types); } try { if ($params) { [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); $stmt = $connection->prepare($sql); if ($types) { $this->_bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } } else { $stmt = $connection->query($sql); } } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql, $params, $types); } $stmt->setFetchMode($this->defaultFetchMode); if ($logger) { $logger->stopQuery(); } return $this->ensureForwardCompatibilityStatement($stmt); } public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) { $resultCache = $qcp->getResultCacheDriver() ?? $this->_config->getResultCacheImpl(); if ($resultCache === null) { throw CacheException::noResultDriverConfigured(); } $connectionParams = $this->params; unset($connectionParams['platform']); [$cacheKey, $realKey] = $qcp->generateCacheKeys($sql, $params, $types, $connectionParams); $data = $resultCache->fetch($cacheKey); if ($data !== \false) { if (isset($data[$realKey])) { $stmt = new ArrayStatement($data[$realKey]); } elseif (array_key_exists($realKey, $data)) { $stmt = new ArrayStatement([]); } } if (!isset($stmt)) { $stmt = new ResultCacheStatement($this->executeQuery($sql, $params, $types), $resultCache, $cacheKey, $realKey, $qcp->getLifetime()); } $stmt->setFetchMode($this->defaultFetchMode); return $this->ensureForwardCompatibilityStatement($stmt); } private function ensureForwardCompatibilityStatement(ResultStatement $stmt) { return ForwardCompatibility\Result::ensure($stmt); } public function project($sql, array $params, Closure $function) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3823', 'Connection::project() is deprecated without replacement, implement data projections in your own code.'); $result = []; $stmt = $this->executeQuery($sql, $params); while ($row = $stmt->fetch()) { $result[] = $function($row); } $stmt->closeCursor(); return $result; } public function query() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::query() is deprecated, use Connection::executeQuery() instead.'); $connection = $this->getWrappedConnection(); $args = func_get_args(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($args[0]); } try { $statement = $connection->query(...$args); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $args[0]); } $statement->setFetchMode($this->defaultFetchMode); if ($logger) { $logger->stopQuery(); } return $statement; } public function executeUpdate($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::executeUpdate() is deprecated, use Connection::executeStatement() instead.'); return $this->executeStatement($sql, $params, $types); } public function executeStatement($sql, array $params = [], array $types = []) { $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql, $params, $types); } try { if ($params) { [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); $stmt = $connection->prepare($sql); if ($types) { $this->_bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } $result = $stmt->rowCount(); } else { $result = $connection->exec($sql); } } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql, $params, $types); } if ($logger) { $logger->stopQuery(); } return $result; } public function exec($sql) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::exec() is deprecated, use Connection::executeStatement() instead.'); $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql); } try { $result = $connection->exec($sql); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql); } if ($logger) { $logger->stopQuery(); } return $result; } public function getTransactionNestingLevel() { return $this->transactionNestingLevel; } public function errorCode() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3507', 'Connection::errorCode() is deprecated, use getCode() or getSQLState() on Exception instead.'); return $this->getWrappedConnection()->errorCode(); } public function errorInfo() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3507', 'Connection::errorInfo() is deprecated, use getCode() or getSQLState() on Exception instead.'); return $this->getWrappedConnection()->errorInfo(); } public function lastInsertId($name = null) { return $this->getWrappedConnection()->lastInsertId($name); } public function transactional(Closure $func) { $this->beginTransaction(); try { $res = $func($this); $this->commit(); return $res; } catch (Throwable $e) { $this->rollBack(); throw $e; } } public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) { if ($this->transactionNestingLevel > 0) { throw ConnectionException::mayNotAlterNestedTransactionWithSavepointsInTransaction(); } if (!$this->getDatabasePlatform()->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->nestTransactionsWithSavepoints = (bool) $nestTransactionsWithSavepoints; } public function getNestTransactionsWithSavepoints() { return $this->nestTransactionsWithSavepoints; } protected function _getNestedTransactionSavePointName() { return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel; } public function beginTransaction() { $connection = $this->getWrappedConnection(); ++$this->transactionNestingLevel; $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"START TRANSACTION"'); } $connection->beginTransaction(); if ($logger) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"SAVEPOINT"'); } $this->createSavepoint($this->_getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } } return \true; } public function commit() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } if ($this->isRollbackOnly) { throw ConnectionException::commitFailedRollbackOnly(); } $result = \true; $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"COMMIT"'); } $result = $connection->commit(); if ($logger) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"RELEASE SAVEPOINT"'); } $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } } --$this->transactionNestingLevel; if ($this->autoCommit !== \false || $this->transactionNestingLevel !== 0) { return $result; } $this->beginTransaction(); return $result; } private function commitAll() : void { while ($this->transactionNestingLevel !== 0) { if ($this->autoCommit === \false && $this->transactionNestingLevel === 1) { $this->commit(); return; } $this->commit(); } } public function rollBack() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"ROLLBACK"'); } $this->transactionNestingLevel = 0; $connection->rollBack(); $this->isRollbackOnly = \false; if ($logger) { $logger->stopQuery(); } if ($this->autoCommit === \false) { $this->beginTransaction(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"ROLLBACK TO SAVEPOINT"'); } $this->rollbackSavepoint($this->_getNestedTransactionSavePointName()); --$this->transactionNestingLevel; if ($logger) { $logger->stopQuery(); } } else { $this->isRollbackOnly = \true; --$this->transactionNestingLevel; } return \true; } public function createSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->getWrappedConnection()->exec($platform->createSavePoint($savepoint)); } public function releaseSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } if (!$platform->supportsReleaseSavepoints()) { return; } $this->getWrappedConnection()->exec($platform->releaseSavePoint($savepoint)); } public function rollbackSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->getWrappedConnection()->exec($platform->rollbackSavePoint($savepoint)); } public function getWrappedConnection() { $this->connect(); assert($this->_conn !== null); return $this->_conn; } public function getSchemaManager() { if ($this->_schemaManager === null) { $this->_schemaManager = $this->_driver->getSchemaManager($this); } return $this->_schemaManager; } public function setRollbackOnly() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } $this->isRollbackOnly = \true; } public function isRollbackOnly() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } return $this->isRollbackOnly; } public function convertToDatabaseValue($value, $type) { return Type::getType($type)->convertToDatabaseValue($value, $this->getDatabasePlatform()); } public function convertToPHPValue($value, $type) { return Type::getType($type)->convertToPHPValue($value, $this->getDatabasePlatform()); } private function _bindTypedValues($stmt, array $params, array $types) { if (is_int(key($params))) { $typeOffset = array_key_exists(0, $types) ? -1 : 0; $bindIndex = 1; foreach ($params as $value) { $typeIndex = $bindIndex + $typeOffset; if (isset($types[$typeIndex])) { $type = $types[$typeIndex]; [$value, $bindingType] = $this->getBindingInfo($value, $type); $stmt->bindValue($bindIndex, $value, $bindingType); } else { $stmt->bindValue($bindIndex, $value); } ++$bindIndex; } } else { foreach ($params as $name => $value) { if (isset($types[$name])) { $type = $types[$name]; [$value, $bindingType] = $this->getBindingInfo($value, $type); $stmt->bindValue($name, $value, $bindingType); } else { $stmt->bindValue($name, $value); } } } } private function getBindingInfo($value, $type) { if (is_string($type)) { $type = Type::getType($type); } if ($type instanceof Type) { $value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform()); $bindingType = $type->getBindingType(); } else { $bindingType = $type; } return [$value, $bindingType]; } public function resolveParams(array $params, array $types) { $resolvedParams = []; if (is_int(key($params))) { $typeOffset = array_key_exists(0, $types) ? -1 : 0; $bindIndex = 1; foreach ($params as $value) { $typeIndex = $bindIndex + $typeOffset; if (isset($types[$typeIndex])) { $type = $types[$typeIndex]; [$value] = $this->getBindingInfo($value, $type); $resolvedParams[$bindIndex] = $value; } else { $resolvedParams[$bindIndex] = $value; } ++$bindIndex; } } else { foreach ($params as $name => $value) { if (isset($types[$name])) { $type = $types[$name]; [$value] = $this->getBindingInfo($value, $type); $resolvedParams[$name] = $value; } else { $resolvedParams[$name] = $value; } } } return $resolvedParams; } public function createQueryBuilder() { return new Query\QueryBuilder($this); } public function ping() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4119', 'Retry and reconnecting lost connections now happens automatically, ping() will be removed in DBAL 3.'); $connection = $this->getWrappedConnection(); if ($connection instanceof PingableConnection) { return $connection->ping(); } try { $this->query($this->getDatabasePlatform()->getDummySelectSQL()); return \true; } catch (DBALException $e) { return \false; } } public function handleExceptionDuringQuery(Throwable $e, string $sql, array $params = [], array $types = []) : void { $this->throw(Exception::driverExceptionDuringQuery($this->_driver, $e, $sql, $this->resolveParams($params, $types))); } public function handleDriverException(Throwable $e) : void { $this->throw(Exception::driverException($this->_driver, $e)); } private function throw(Exception $e) : void { if ($e instanceof ConnectionLost) { $this->close(); } throw $e; } private function ensureHasKeyValue(ResultStatement $stmt) : void { $columnCount = $stmt->columnCount(); if ($columnCount < 2) { throw NoKeyValue::fromColumnCount($columnCount); } } } 
<?php
 declare (strict_types=1); namespace MailPoetVendor\Doctrine\DBAL\Driver\PDO; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Driver\PDOException; final class Exception extends PDOException { public static function new(\PDOException $exception) : self { return new self($exception); } } 
Exception message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
<?php
 namespace MailPoetVendor\Doctrine\DBAL\Driver; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Driver\PDO\Exception; use MailPoetVendor\Doctrine\DBAL\Driver\Statement as StatementInterface; use MailPoetVendor\Doctrine\DBAL\FetchMode; use MailPoetVendor\Doctrine\DBAL\ParameterType; use MailPoetVendor\Doctrine\Deprecations\Deprecation; use PDO; use PDOException; use function array_slice; use function assert; use function func_get_args; use function is_array; class PDOStatement extends \PDOStatement implements StatementInterface, Result { use PDOStatementImplementations; private const PARAM_TYPE_MAP = [ParameterType::NULL => PDO::PARAM_NULL, ParameterType::INTEGER => PDO::PARAM_INT, ParameterType::STRING => PDO::PARAM_STR, ParameterType::ASCII => PDO::PARAM_STR, ParameterType::BINARY => PDO::PARAM_LOB, ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, ParameterType::BOOLEAN => PDO::PARAM_BOOL]; private const FETCH_MODE_MAP = [FetchMode::ASSOCIATIVE => PDO::FETCH_ASSOC, FetchMode::NUMERIC => PDO::FETCH_NUM, FetchMode::MIXED => PDO::FETCH_BOTH, FetchMode::STANDARD_OBJECT => PDO::FETCH_OBJ, FetchMode::COLUMN => PDO::FETCH_COLUMN, FetchMode::CUSTOM_OBJECT => PDO::FETCH_CLASS]; protected function __construct() { } public function bindValue($param, $value, $type = ParameterType::STRING) { $type = $this->convertParamType($type); try { return parent::bindValue($param, $value, $type); } catch (PDOException $exception) { throw Exception::new($exception); } } public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) { $type = $this->convertParamType($type); try { return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); } catch (PDOException $exception) { throw Exception::new($exception); } } public function closeCursor() { try { return parent::closeCursor(); } catch (PDOException $exception) { return \true; } } public function execute($params = null) { try { return parent::execute($params); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) { $args = func_get_args(); if (isset($args[0])) { $args[0] = $this->convertFetchMode($args[0]); } try { return parent::fetch(...$args); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetchColumn($columnIndex = 0) { try { return parent::fetchColumn($columnIndex); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetchNumeric() { return $this->fetch(PDO::FETCH_NUM); } public function fetchAssociative() { return $this->fetch(PDO::FETCH_ASSOC); } public function fetchOne() { return $this->fetch(PDO::FETCH_COLUMN); } public function fetchAllNumeric() : array { return $this->fetchAll(PDO::FETCH_NUM); } public function fetchAllAssociative() : array { return $this->fetchAll(PDO::FETCH_ASSOC); } public function fetchFirstColumn() : array { return $this->fetchAll(PDO::FETCH_COLUMN); } public function free() : void { parent::closeCursor(); } private function doSetFetchMode(int $fetchMode, ...$args) : bool { $fetchMode = $this->convertFetchMode($fetchMode); $slice = []; foreach ($args as $arg) { if ($arg === null) { break; } $slice[] = $arg; } try { return parent::setFetchMode($fetchMode, ...$slice); } catch (PDOException $exception) { throw Exception::new($exception); } } private function doFetchAll(...$args) : array { if (isset($args[0])) { $args[0] = $this->convertFetchMode($args[0]); } $slice = []; foreach ($args as $arg) { if ($arg === null) { break; } $slice[] = $arg; } try { $data = parent::fetchAll(...$slice); } catch (PDOException $exception) { throw Exception::new($exception); } assert(is_array($data)); return $data; } private function convertParamType(int $type) : int { if (!isset(self::PARAM_TYPE_MAP[$type])) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3088', 'Using a PDO parameter type (%d given) is deprecated, ' . 'use \\Doctrine\\DBAL\\Types\\Types constants instead.', $type); return $type; } return self::PARAM_TYPE_MAP[$type]; } private function convertFetchMode(int $fetchMode) : int { if (!isset(self::FETCH_MODE_MAP[$fetchMode])) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3088', 'Using an unsupported PDO fetch mode or a bitmask of fetch modes (%d given)' . ' is deprecated and will cause an error in Doctrine DBAL 3.0', $fetchMode); return $fetchMode; } return self::FETCH_MODE_MAP[$fetchMode]; } } 
Exception message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
<?php
 namespace MailPoetVendor\Doctrine\DBAL\Driver; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\DBAL\Driver\PDO\Exception; use MailPoetVendor\Doctrine\DBAL\Driver\Statement as StatementInterface; use MailPoetVendor\Doctrine\DBAL\FetchMode; use MailPoetVendor\Doctrine\DBAL\ParameterType; use MailPoetVendor\Doctrine\Deprecations\Deprecation; use PDO; use PDOException; use function array_slice; use function assert; use function func_get_args; use function is_array; class PDOStatement extends \PDOStatement implements StatementInterface, Result { use PDOStatementImplementations; private const PARAM_TYPE_MAP = [ParameterType::NULL => PDO::PARAM_NULL, ParameterType::INTEGER => PDO::PARAM_INT, ParameterType::STRING => PDO::PARAM_STR, ParameterType::ASCII => PDO::PARAM_STR, ParameterType::BINARY => PDO::PARAM_LOB, ParameterType::LARGE_OBJECT => PDO::PARAM_LOB, ParameterType::BOOLEAN => PDO::PARAM_BOOL]; private const FETCH_MODE_MAP = [FetchMode::ASSOCIATIVE => PDO::FETCH_ASSOC, FetchMode::NUMERIC => PDO::FETCH_NUM, FetchMode::MIXED => PDO::FETCH_BOTH, FetchMode::STANDARD_OBJECT => PDO::FETCH_OBJ, FetchMode::COLUMN => PDO::FETCH_COLUMN, FetchMode::CUSTOM_OBJECT => PDO::FETCH_CLASS]; protected function __construct() { } public function bindValue($param, $value, $type = ParameterType::STRING) { $type = $this->convertParamType($type); try { return parent::bindValue($param, $value, $type); } catch (PDOException $exception) { throw Exception::new($exception); } } public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null, $driverOptions = null) { $type = $this->convertParamType($type); try { return parent::bindParam($param, $variable, $type, ...array_slice(func_get_args(), 3)); } catch (PDOException $exception) { throw Exception::new($exception); } } public function closeCursor() { try { return parent::closeCursor(); } catch (PDOException $exception) { return \true; } } public function execute($params = null) { try { return parent::execute($params); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) { $args = func_get_args(); if (isset($args[0])) { $args[0] = $this->convertFetchMode($args[0]); } try { return parent::fetch(...$args); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetchColumn($columnIndex = 0) { try { return parent::fetchColumn($columnIndex); } catch (PDOException $exception) { throw Exception::new($exception); } } public function fetchNumeric() { return $this->fetch(PDO::FETCH_NUM); } public function fetchAssociative() { return $this->fetch(PDO::FETCH_ASSOC); } public function fetchOne() { return $this->fetch(PDO::FETCH_COLUMN); } public function fetchAllNumeric() : array { return $this->fetchAll(PDO::FETCH_NUM); } public function fetchAllAssociative() : array { return $this->fetchAll(PDO::FETCH_ASSOC); } public function fetchFirstColumn() : array { return $this->fetchAll(PDO::FETCH_COLUMN); } public function free() : void { parent::closeCursor(); } private function doSetFetchMode(int $fetchMode, ...$args) : bool { $fetchMode = $this->convertFetchMode($fetchMode); $slice = []; foreach ($args as $arg) { if ($arg === null) { break; } $slice[] = $arg; } try { return parent::setFetchMode($fetchMode, ...$slice); } catch (PDOException $exception) { throw Exception::new($exception); } } private function doFetchAll(...$args) : array { if (isset($args[0])) { $args[0] = $this->convertFetchMode($args[0]); } $slice = []; foreach ($args as $arg) { if ($arg === null) { break; } $slice[] = $arg; } try { $data = parent::fetchAll(...$slice); } catch (PDOException $exception) { throw Exception::new($exception); } assert(is_array($data)); return $data; } private function convertParamType(int $type) : int { if (!isset(self::PARAM_TYPE_MAP[$type])) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3088', 'Using a PDO parameter type (%d given) is deprecated, ' . 'use \\Doctrine\\DBAL\\Types\\Types constants instead.', $type); return $type; } return self::PARAM_TYPE_MAP[$type]; } private function convertFetchMode(int $fetchMode) : int { if (!isset(self::FETCH_MODE_MAP[$fetchMode])) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3088', 'Using an unsupported PDO fetch mode or a bitmask of fetch modes (%d given)' . ' is deprecated and will cause an error in Doctrine DBAL 3.0', $fetchMode); return $fetchMode; } return self::FETCH_MODE_MAP[$fetchMode]; } } 
<?php
 namespace MailPoetVendor\Doctrine\DBAL; if (!defined('ABSPATH')) exit; use Closure; use MailPoetVendor\Doctrine\Common\EventManager; use MailPoetVendor\Doctrine\DBAL\Cache\ArrayStatement; use MailPoetVendor\Doctrine\DBAL\Cache\CacheException; use MailPoetVendor\Doctrine\DBAL\Cache\QueryCacheProfile; use MailPoetVendor\Doctrine\DBAL\Cache\ResultCacheStatement; use MailPoetVendor\Doctrine\DBAL\Driver\Connection as DriverConnection; use MailPoetVendor\Doctrine\DBAL\Driver\PingableConnection; use MailPoetVendor\Doctrine\DBAL\Driver\ResultStatement; use MailPoetVendor\Doctrine\DBAL\Driver\ServerInfoAwareConnection; use MailPoetVendor\Doctrine\DBAL\Exception\ConnectionLost; use MailPoetVendor\Doctrine\DBAL\Exception\InvalidArgumentException; use MailPoetVendor\Doctrine\DBAL\Exception\NoKeyValue; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Query\Expression\ExpressionBuilder; use MailPoetVendor\Doctrine\DBAL\Query\QueryBuilder; use MailPoetVendor\Doctrine\DBAL\Schema\AbstractSchemaManager; use MailPoetVendor\Doctrine\DBAL\Types\Type; use MailPoetVendor\Doctrine\Deprecations\Deprecation; use Throwable; use Traversable; use function array_key_exists; use function array_shift; use function assert; use function func_get_args; use function implode; use function is_int; use function is_string; use function key; class Connection implements DriverConnection { public const TRANSACTION_READ_UNCOMMITTED = TransactionIsolationLevel::READ_UNCOMMITTED; public const TRANSACTION_READ_COMMITTED = TransactionIsolationLevel::READ_COMMITTED; public const TRANSACTION_REPEATABLE_READ = TransactionIsolationLevel::REPEATABLE_READ; public const TRANSACTION_SERIALIZABLE = TransactionIsolationLevel::SERIALIZABLE; public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET; public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET; public const ARRAY_PARAM_OFFSET = 100; protected $_conn; protected $_config; protected $_eventManager; protected $_expr; private $autoCommit = \true; private $transactionNestingLevel = 0; private $transactionIsolationLevel; private $nestTransactionsWithSavepoints = \false; private $params; private $platform; protected $_schemaManager; protected $_driver; private $isRollbackOnly = \false; protected $defaultFetchMode = FetchMode::ASSOCIATIVE; public function __construct(array $params, Driver $driver, ?Configuration $config = null, ?EventManager $eventManager = null) { $this->_driver = $driver; $this->params = $params; if (isset($params['pdo'])) { $this->_conn = $params['pdo']; unset($this->params['pdo']); } if (isset($params['platform'])) { if (!$params['platform'] instanceof Platforms\AbstractPlatform) { throw Exception::invalidPlatformType($params['platform']); } $this->platform = $params['platform']; } if (!$config) { $config = new Configuration(); } if (!$eventManager) { $eventManager = new EventManager(); } $this->_config = $config; $this->_eventManager = $eventManager; $this->_expr = new Query\Expression\ExpressionBuilder($this); $this->autoCommit = $config->getAutoCommit(); } public function getParams() { return $this->params; } public function getDatabase() { return $this->_driver->getDatabase($this); } public function getHost() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getHost() is deprecated, get the database server host from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['host'] ?? null; } public function getPort() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getPort() is deprecated, get the database server port from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['port'] ?? null; } public function getUsername() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getUsername() is deprecated, get the username from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['user'] ?? null; } public function getPassword() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Connection::getPassword() is deprecated, get the password from application config ' . 'or as a last resort from internal Connection::getParams() API.'); return $this->params['password'] ?? null; } public function getDriver() { return $this->_driver; } public function getConfiguration() { return $this->_config; } public function getEventManager() { return $this->_eventManager; } public function getDatabasePlatform() { if ($this->platform === null) { $this->platform = $this->detectDatabasePlatform(); $this->platform->setEventManager($this->_eventManager); } return $this->platform; } public function getExpressionBuilder() { return $this->_expr; } public function connect() { if ($this->_conn !== null) { return \false; } $driverOptions = $this->params['driverOptions'] ?? []; $user = $this->params['user'] ?? null; $password = $this->params['password'] ?? null; $this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions); $this->transactionNestingLevel = 0; if ($this->autoCommit === \false) { $this->beginTransaction(); } if ($this->_eventManager->hasListeners(Events::postConnect)) { $eventArgs = new Event\ConnectionEventArgs($this); $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); } return \true; } private function detectDatabasePlatform() : AbstractPlatform { $version = $this->getDatabasePlatformVersion(); if ($version !== null) { assert($this->_driver instanceof VersionAwarePlatformDriver); return $this->_driver->createDatabasePlatformForVersion($version); } return $this->_driver->getDatabasePlatform(); } private function getDatabasePlatformVersion() { if (!$this->_driver instanceof VersionAwarePlatformDriver) { return null; } if (isset($this->params['serverVersion'])) { return $this->params['serverVersion']; } if ($this->_conn === null) { try { $this->connect(); } catch (Throwable $originalException) { if (empty($this->params['dbname'])) { throw $originalException; } $params = $this->params; unset($this->params['dbname']); try { $this->connect(); } catch (Throwable $fallbackException) { throw $originalException; } finally { $this->params = $params; } $serverVersion = $this->getServerVersion(); $this->close(); return $serverVersion; } } return $this->getServerVersion(); } private function getServerVersion() { $connection = $this->getWrappedConnection(); if ($connection instanceof ServerInfoAwareConnection && !$connection->requiresQueryForServerVersion()) { return $connection->getServerVersion(); } return null; } public function isAutoCommit() { return $this->autoCommit === \true; } public function setAutoCommit($autoCommit) { $autoCommit = (bool) $autoCommit; if ($autoCommit === $this->autoCommit) { return; } $this->autoCommit = $autoCommit; if ($this->_conn === null || $this->transactionNestingLevel === 0) { return; } $this->commitAll(); } public function setFetchMode($fetchMode) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Default Fetch Mode configuration is deprecated, use explicit Connection::fetch*() APIs instead.'); $this->defaultFetchMode = $fetchMode; } public function fetchAssoc($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchAssoc() is deprecated, use Connection::fetchAssociative() API instead.'); return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::ASSOCIATIVE); } public function fetchArray($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchArray() is deprecated, use Connection::fetchNumeric() API instead.'); return $this->executeQuery($sql, $params, $types)->fetch(FetchMode::NUMERIC); } public function fetchColumn($sql, array $params = [], $column = 0, array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4019', 'Connection::fetchColumn() is deprecated, use Connection::fetchOne() API instead.'); return $this->executeQuery($sql, $params, $types)->fetchColumn($column); } public function fetchAssociative(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchNumeric(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchOne(string $query, array $params = [], array $types = []) { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchOne(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function isConnected() { return $this->_conn !== null; } public function isTransactionActive() { return $this->transactionNestingLevel > 0; } private function addCriteriaCondition(array $criteria, array &$columns, array &$values, array &$conditions) : void { $platform = $this->getDatabasePlatform(); foreach ($criteria as $columnName => $value) { if ($value === null) { $conditions[] = $platform->getIsNullExpression($columnName); continue; } $columns[] = $columnName; $values[] = $value; $conditions[] = $columnName . ' = ?'; } } public function delete($table, array $criteria, array $types = []) { if (empty($criteria)) { throw InvalidArgumentException::fromEmptyCriteria(); } $columns = $values = $conditions = []; $this->addCriteriaCondition($criteria, $columns, $values, $conditions); return $this->executeStatement('DELETE FROM ' . $table . ' WHERE ' . implode(' AND ', $conditions), $values, is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types); } public function close() { $this->_conn = null; } public function setTransactionIsolation($level) { $this->transactionIsolationLevel = $level; return $this->executeStatement($this->getDatabasePlatform()->getSetTransactionIsolationSQL($level)); } public function getTransactionIsolation() { if ($this->transactionIsolationLevel === null) { $this->transactionIsolationLevel = $this->getDatabasePlatform()->getDefaultTransactionIsolationLevel(); } return $this->transactionIsolationLevel; } public function update($table, array $data, array $criteria, array $types = []) { $columns = $values = $conditions = $set = []; foreach ($data as $columnName => $value) { $columns[] = $columnName; $values[] = $value; $set[] = $columnName . ' = ?'; } $this->addCriteriaCondition($criteria, $columns, $values, $conditions); if (is_string(key($types))) { $types = $this->extractTypeValues($columns, $types); } $sql = 'UPDATE ' . $table . ' SET ' . implode(', ', $set) . ' WHERE ' . implode(' AND ', $conditions); return $this->executeStatement($sql, $values, $types); } public function insert($table, array $data, array $types = []) { if (empty($data)) { return $this->executeStatement('INSERT INTO ' . $table . ' () VALUES ()'); } $columns = []; $values = []; $set = []; foreach ($data as $columnName => $value) { $columns[] = $columnName; $values[] = $value; $set[] = '?'; } return $this->executeStatement('INSERT INTO ' . $table . ' (' . implode(', ', $columns) . ')' . ' VALUES (' . implode(', ', $set) . ')', $values, is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types); } private function extractTypeValues(array $columnList, array $types) { $typeValues = []; foreach ($columnList as $columnIndex => $columnName) { $typeValues[] = $types[$columnName] ?? ParameterType::STRING; } return $typeValues; } public function quoteIdentifier($str) { return $this->getDatabasePlatform()->quoteIdentifier($str); } public function quote($value, $type = ParameterType::STRING) { $connection = $this->getWrappedConnection(); [$value, $bindingType] = $this->getBindingInfo($value, $type); return $connection->quote($value, $bindingType); } public function fetchAll($sql, array $params = [], $types = []) { return $this->executeQuery($sql, $params, $types)->fetchAll(); } public function fetchAllNumeric(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAllNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchAllAssociative(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchAllAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function fetchAllKeyValue(string $query, array $params = [], array $types = []) : array { $stmt = $this->executeQuery($query, $params, $types); $this->ensureHasKeyValue($stmt); $data = []; foreach ($stmt->fetchAll(FetchMode::NUMERIC) as [$key, $value]) { $data[$key] = $value; } return $data; } public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []) : array { $stmt = $this->executeQuery($query, $params, $types); $data = []; foreach ($stmt->fetchAll(FetchMode::ASSOCIATIVE) as $row) { $data[array_shift($row)] = $row; } return $data; } public function fetchFirstColumn(string $query, array $params = [], array $types = []) : array { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); return $stmt->fetchFirstColumn(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateNumeric(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateNumeric(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateAssociative(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateAssociative(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function iterateKeyValue(string $query, array $params = [], array $types = []) : Traversable { $stmt = $this->executeQuery($query, $params, $types); $this->ensureHasKeyValue($stmt); while (($row = $stmt->fetch(FetchMode::NUMERIC)) !== \false) { (yield $row[0] => $row[1]); } } public function iterateAssociativeIndexed(string $query, array $params = [], array $types = []) : Traversable { $stmt = $this->executeQuery($query, $params, $types); while (($row = $stmt->fetch(FetchMode::ASSOCIATIVE)) !== \false) { (yield array_shift($row) => $row); } } public function iterateColumn(string $query, array $params = [], array $types = []) : Traversable { try { $stmt = $this->ensureForwardCompatibilityStatement($this->executeQuery($query, $params, $types)); yield from $stmt->iterateColumn(); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $query, $params, $types); } } public function prepare($sql) { try { $stmt = new Statement($sql, $this); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql); } $stmt->setFetchMode($this->defaultFetchMode); return $stmt; } public function executeQuery($sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null) { if ($qcp !== null) { return $this->executeCacheQuery($sql, $params, $types, $qcp); } $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql, $params, $types); } try { if ($params) { [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); $stmt = $connection->prepare($sql); if ($types) { $this->_bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } } else { $stmt = $connection->query($sql); } } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql, $params, $types); } $stmt->setFetchMode($this->defaultFetchMode); if ($logger) { $logger->stopQuery(); } return $this->ensureForwardCompatibilityStatement($stmt); } public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp) { $resultCache = $qcp->getResultCacheDriver() ?? $this->_config->getResultCacheImpl(); if ($resultCache === null) { throw CacheException::noResultDriverConfigured(); } $connectionParams = $this->params; unset($connectionParams['platform']); [$cacheKey, $realKey] = $qcp->generateCacheKeys($sql, $params, $types, $connectionParams); $data = $resultCache->fetch($cacheKey); if ($data !== \false) { if (isset($data[$realKey])) { $stmt = new ArrayStatement($data[$realKey]); } elseif (array_key_exists($realKey, $data)) { $stmt = new ArrayStatement([]); } } if (!isset($stmt)) { $stmt = new ResultCacheStatement($this->executeQuery($sql, $params, $types), $resultCache, $cacheKey, $realKey, $qcp->getLifetime()); } $stmt->setFetchMode($this->defaultFetchMode); return $this->ensureForwardCompatibilityStatement($stmt); } private function ensureForwardCompatibilityStatement(ResultStatement $stmt) { return ForwardCompatibility\Result::ensure($stmt); } public function project($sql, array $params, Closure $function) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3823', 'Connection::project() is deprecated without replacement, implement data projections in your own code.'); $result = []; $stmt = $this->executeQuery($sql, $params); while ($row = $stmt->fetch()) { $result[] = $function($row); } $stmt->closeCursor(); return $result; } public function query() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::query() is deprecated, use Connection::executeQuery() instead.'); $connection = $this->getWrappedConnection(); $args = func_get_args(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($args[0]); } try { $statement = $connection->query(...$args); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $args[0]); } $statement->setFetchMode($this->defaultFetchMode); if ($logger) { $logger->stopQuery(); } return $statement; } public function executeUpdate($sql, array $params = [], array $types = []) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::executeUpdate() is deprecated, use Connection::executeStatement() instead.'); return $this->executeStatement($sql, $params, $types); } public function executeStatement($sql, array $params = [], array $types = []) { $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql, $params, $types); } try { if ($params) { [$sql, $params, $types] = SQLParserUtils::expandListParameters($sql, $params, $types); $stmt = $connection->prepare($sql); if ($types) { $this->_bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } $result = $stmt->rowCount(); } else { $result = $connection->exec($sql); } } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql, $params, $types); } if ($logger) { $logger->stopQuery(); } return $result; } public function exec($sql) { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4163', 'Connection::exec() is deprecated, use Connection::executeStatement() instead.'); $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($logger) { $logger->startQuery($sql); } try { $result = $connection->exec($sql); } catch (Throwable $e) { $this->handleExceptionDuringQuery($e, $sql); } if ($logger) { $logger->stopQuery(); } return $result; } public function getTransactionNestingLevel() { return $this->transactionNestingLevel; } public function errorCode() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3507', 'Connection::errorCode() is deprecated, use getCode() or getSQLState() on Exception instead.'); return $this->getWrappedConnection()->errorCode(); } public function errorInfo() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3507', 'Connection::errorInfo() is deprecated, use getCode() or getSQLState() on Exception instead.'); return $this->getWrappedConnection()->errorInfo(); } public function lastInsertId($name = null) { return $this->getWrappedConnection()->lastInsertId($name); } public function transactional(Closure $func) { $this->beginTransaction(); try { $res = $func($this); $this->commit(); return $res; } catch (Throwable $e) { $this->rollBack(); throw $e; } } public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) { if ($this->transactionNestingLevel > 0) { throw ConnectionException::mayNotAlterNestedTransactionWithSavepointsInTransaction(); } if (!$this->getDatabasePlatform()->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->nestTransactionsWithSavepoints = (bool) $nestTransactionsWithSavepoints; } public function getNestTransactionsWithSavepoints() { return $this->nestTransactionsWithSavepoints; } protected function _getNestedTransactionSavePointName() { return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel; } public function beginTransaction() { $connection = $this->getWrappedConnection(); ++$this->transactionNestingLevel; $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"START TRANSACTION"'); } $connection->beginTransaction(); if ($logger) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"SAVEPOINT"'); } $this->createSavepoint($this->_getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } } return \true; } public function commit() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } if ($this->isRollbackOnly) { throw ConnectionException::commitFailedRollbackOnly(); } $result = \true; $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"COMMIT"'); } $result = $connection->commit(); if ($logger) { $logger->stopQuery(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"RELEASE SAVEPOINT"'); } $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } } --$this->transactionNestingLevel; if ($this->autoCommit !== \false || $this->transactionNestingLevel !== 0) { return $result; } $this->beginTransaction(); return $result; } private function commitAll() : void { while ($this->transactionNestingLevel !== 0) { if ($this->autoCommit === \false && $this->transactionNestingLevel === 1) { $this->commit(); return; } $this->commit(); } } public function rollBack() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } $connection = $this->getWrappedConnection(); $logger = $this->_config->getSQLLogger(); if ($this->transactionNestingLevel === 1) { if ($logger) { $logger->startQuery('"ROLLBACK"'); } $this->transactionNestingLevel = 0; $connection->rollBack(); $this->isRollbackOnly = \false; if ($logger) { $logger->stopQuery(); } if ($this->autoCommit === \false) { $this->beginTransaction(); } } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"ROLLBACK TO SAVEPOINT"'); } $this->rollbackSavepoint($this->_getNestedTransactionSavePointName()); --$this->transactionNestingLevel; if ($logger) { $logger->stopQuery(); } } else { $this->isRollbackOnly = \true; --$this->transactionNestingLevel; } return \true; } public function createSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->getWrappedConnection()->exec($platform->createSavePoint($savepoint)); } public function releaseSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } if (!$platform->supportsReleaseSavepoints()) { return; } $this->getWrappedConnection()->exec($platform->releaseSavePoint($savepoint)); } public function rollbackSavepoint($savepoint) { $platform = $this->getDatabasePlatform(); if (!$platform->supportsSavepoints()) { throw ConnectionException::savepointsNotSupported(); } $this->getWrappedConnection()->exec($platform->rollbackSavePoint($savepoint)); } public function getWrappedConnection() { $this->connect(); assert($this->_conn !== null); return $this->_conn; } public function getSchemaManager() { if ($this->_schemaManager === null) { $this->_schemaManager = $this->_driver->getSchemaManager($this); } return $this->_schemaManager; } public function setRollbackOnly() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } $this->isRollbackOnly = \true; } public function isRollbackOnly() { if ($this->transactionNestingLevel === 0) { throw ConnectionException::noActiveTransaction(); } return $this->isRollbackOnly; } public function convertToDatabaseValue($value, $type) { return Type::getType($type)->convertToDatabaseValue($value, $this->getDatabasePlatform()); } public function convertToPHPValue($value, $type) { return Type::getType($type)->convertToPHPValue($value, $this->getDatabasePlatform()); } private function _bindTypedValues($stmt, array $params, array $types) { if (is_int(key($params))) { $typeOffset = array_key_exists(0, $types) ? -1 : 0; $bindIndex = 1; foreach ($params as $value) { $typeIndex = $bindIndex + $typeOffset; if (isset($types[$typeIndex])) { $type = $types[$typeIndex]; [$value, $bindingType] = $this->getBindingInfo($value, $type); $stmt->bindValue($bindIndex, $value, $bindingType); } else { $stmt->bindValue($bindIndex, $value); } ++$bindIndex; } } else { foreach ($params as $name => $value) { if (isset($types[$name])) { $type = $types[$name]; [$value, $bindingType] = $this->getBindingInfo($value, $type); $stmt->bindValue($name, $value, $bindingType); } else { $stmt->bindValue($name, $value); } } } } private function getBindingInfo($value, $type) { if (is_string($type)) { $type = Type::getType($type); } if ($type instanceof Type) { $value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform()); $bindingType = $type->getBindingType(); } else { $bindingType = $type; } return [$value, $bindingType]; } public function resolveParams(array $params, array $types) { $resolvedParams = []; if (is_int(key($params))) { $typeOffset = array_key_exists(0, $types) ? -1 : 0; $bindIndex = 1; foreach ($params as $value) { $typeIndex = $bindIndex + $typeOffset; if (isset($types[$typeIndex])) { $type = $types[$typeIndex]; [$value] = $this->getBindingInfo($value, $type); $resolvedParams[$bindIndex] = $value; } else { $resolvedParams[$bindIndex] = $value; } ++$bindIndex; } } else { foreach ($params as $name => $value) { if (isset($types[$name])) { $type = $types[$name]; [$value] = $this->getBindingInfo($value, $type); $resolvedParams[$name] = $value; } else { $resolvedParams[$name] = $value; } } } return $resolvedParams; } public function createQueryBuilder() { return new Query\QueryBuilder($this); } public function ping() { Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4119', 'Retry and reconnecting lost connections now happens automatically, ping() will be removed in DBAL 3.'); $connection = $this->getWrappedConnection(); if ($connection instanceof PingableConnection) { return $connection->ping(); } try { $this->query($this->getDatabasePlatform()->getDummySelectSQL()); return \true; } catch (DBALException $e) { return \false; } } public function handleExceptionDuringQuery(Throwable $e, string $sql, array $params = [], array $types = []) : void { $this->throw(Exception::driverExceptionDuringQuery($this->_driver, $e, $sql, $this->resolveParams($params, $types))); } public function handleDriverException(Throwable $e) : void { $this->throw(Exception::driverException($this->_driver, $e)); } private function throw(Exception $e) : void { if ($e instanceof ConnectionLost) { $this->close(); } throw $e; } private function ensureHasKeyValue(ResultStatement $stmt) : void { $columnCount = $stmt->columnCount(); if ($columnCount < 2) { throw NoKeyValue::fromColumnCount($columnCount); } } } 
<?php
 namespace MailPoetVendor\Doctrine\ORM\Persisters\Entity; if (!defined('ABSPATH')) exit; use MailPoetVendor\Doctrine\Common\Collections\Criteria; use MailPoetVendor\Doctrine\Common\Collections\Expr\Comparison; use MailPoetVendor\Doctrine\Common\Util\ClassUtils; use MailPoetVendor\Doctrine\DBAL\Connection; use MailPoetVendor\Doctrine\DBAL\Driver\ResultStatement as DriverStatement; use MailPoetVendor\Doctrine\DBAL\LockMode; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Types\Type; use MailPoetVendor\Doctrine\ORM\EntityManagerInterface; use MailPoetVendor\Doctrine\ORM\Mapping\ClassMetadata; use MailPoetVendor\Doctrine\ORM\Mapping\MappingException; use MailPoetVendor\Doctrine\ORM\Mapping\QuoteStrategy; use MailPoetVendor\Doctrine\ORM\OptimisticLockException; use MailPoetVendor\Doctrine\ORM\ORMException; use MailPoetVendor\Doctrine\ORM\PersistentCollection; use MailPoetVendor\Doctrine\ORM\Persisters\SqlExpressionVisitor; use MailPoetVendor\Doctrine\ORM\Persisters\SqlValueVisitor; use MailPoetVendor\Doctrine\ORM\Query; use MailPoetVendor\Doctrine\ORM\Query\QueryException; use MailPoetVendor\Doctrine\ORM\UnitOfWork; use MailPoetVendor\Doctrine\ORM\Utility\IdentifierFlattener; use MailPoetVendor\Doctrine\ORM\Utility\PersisterHelper; use function array_combine; use function array_map; use function array_merge; use function array_search; use function array_unique; use function array_values; use function assert; use function count; use function get_class; use function implode; use function is_array; use function is_object; use function reset; use function spl_object_hash; use function sprintf; use function strpos; use function strtoupper; use function trim; class BasicEntityPersister implements EntityPersister { private static $comparisonMap = [Comparison::EQ => '= %s', Comparison::NEQ => '!= %s', Comparison::GT => '> %s', Comparison::GTE => '>= %s', Comparison::LT => '< %s', Comparison::LTE => '<= %s', Comparison::IN => 'IN (%s)', Comparison::NIN => 'NOT IN (%s)', Comparison::CONTAINS => 'LIKE %s', Comparison::STARTS_WITH => 'LIKE %s', Comparison::ENDS_WITH => 'LIKE %s']; protected $class; protected $conn; protected $platform; protected $em; protected $queuedInserts = []; protected $columnTypes = []; protected $quotedColumns = []; private $insertSql; protected $quoteStrategy; private $identifierFlattener; protected $currentPersisterContext; private $limitsHandlingContext; private $noLimitsContext; public function __construct(EntityManagerInterface $em, ClassMetadata $class) { $this->em = $em; $this->class = $class; $this->conn = $em->getConnection(); $this->platform = $this->conn->getDatabasePlatform(); $this->quoteStrategy = $em->getConfiguration()->getQuoteStrategy(); $this->identifierFlattener = new IdentifierFlattener($em->getUnitOfWork(), $em->getMetadataFactory()); $this->noLimitsContext = $this->currentPersisterContext = new CachedPersisterContext($class, new Query\ResultSetMapping(), \false); $this->limitsHandlingContext = new CachedPersisterContext($class, new Query\ResultSetMapping(), \true); } public function getClassMetadata() { return $this->class; } public function getResultSetMapping() { return $this->currentPersisterContext->rsm; } public function addInsert($entity) { $this->queuedInserts[spl_object_hash($entity)] = $entity; } public function getInserts() { return $this->queuedInserts; } public function executeInserts() { if (!$this->queuedInserts) { return []; } $postInsertIds = []; $idGenerator = $this->class->idGenerator; $isPostInsertId = $idGenerator->isPostInsertGenerator(); $stmt = $this->conn->prepare($this->getInsertSQL()); $tableName = $this->class->getTableName(); foreach ($this->queuedInserts as $entity) { $insertData = $this->prepareInsertData($entity); if (isset($insertData[$tableName])) { $paramIndex = 1; foreach ($insertData[$tableName] as $column => $value) { $stmt->bindValue($paramIndex++, $value, $this->columnTypes[$column]); } } $stmt->execute(); if ($isPostInsertId) { $generatedId = $idGenerator->generate($this->em, $entity); $id = [$this->class->identifier[0] => $generatedId]; $postInsertIds[] = ['generatedId' => $generatedId, 'entity' => $entity]; } else { $id = $this->class->getIdentifierValues($entity); } if ($this->class->isVersioned) { $this->assignDefaultVersionValue($entity, $id); } } $stmt->closeCursor(); $this->queuedInserts = []; return $postInsertIds; } protected function assignDefaultVersionValue($entity, array $id) { $value = $this->fetchVersionValue($this->class, $id); $this->class->setFieldValue($entity, $this->class->versionField, $value); } protected function fetchVersionValue($versionedClass, array $id) { $versionField = $versionedClass->versionField; $fieldMapping = $versionedClass->fieldMappings[$versionField]; $tableName = $this->quoteStrategy->getTableName($versionedClass, $this->platform); $identifier = $this->quoteStrategy->getIdentifierColumnNames($versionedClass, $this->platform); $columnName = $this->quoteStrategy->getColumnName($versionField, $versionedClass, $this->platform); $sql = 'SELECT ' . $columnName . ' FROM ' . $tableName . ' WHERE ' . implode(' = ? AND ', $identifier) . ' = ?'; $flatId = $this->identifierFlattener->flattenIdentifier($versionedClass, $id); $value = $this->conn->fetchColumn($sql, array_values($flatId), 0, $this->extractIdentifierTypes($id, $versionedClass)); return Type::getType($fieldMapping['type'])->convertToPHPValue($value, $this->platform); } private function extractIdentifierTypes(array $id, ClassMetadata $versionedClass) : array { $types = []; foreach ($id as $field => $value) { $types = array_merge($types, $this->getTypes($field, $value, $versionedClass)); } return $types; } public function update($entity) { $tableName = $this->class->getTableName(); $updateData = $this->prepareUpdateData($entity); if (!isset($updateData[$tableName])) { return; } $data = $updateData[$tableName]; if (!$data) { return; } $isVersioned = $this->class->isVersioned; $quotedTableName = $this->quoteStrategy->getTableName($this->class, $this->platform); $this->updateTable($entity, $quotedTableName, $data, $isVersioned); if ($isVersioned) { $id = $this->class->getIdentifierValues($entity); $this->assignDefaultVersionValue($entity, $id); } } protected final function updateTable($entity, $quotedTableName, array $updateData, $versioned = \false) : void { $set = []; $types = []; $params = []; foreach ($updateData as $columnName => $value) { $placeholder = '?'; $column = $columnName; switch (\true) { case isset($this->class->fieldNames[$columnName]): $fieldName = $this->class->fieldNames[$columnName]; $column = $this->quoteStrategy->getColumnName($fieldName, $this->class, $this->platform); if (isset($this->class->fieldMappings[$fieldName]['requireSQLConversion'])) { $type = Type::getType($this->columnTypes[$columnName]); $placeholder = $type->convertToDatabaseValueSQL('?', $this->platform); } break; case isset($this->quotedColumns[$columnName]): $column = $this->quotedColumns[$columnName]; break; } $params[] = $value; $set[] = $column . ' = ' . $placeholder; $types[] = $this->columnTypes[$columnName]; } $where = []; $identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity); foreach ($this->class->identifier as $idField) { if (!isset($this->class->associationMappings[$idField])) { $params[] = $identifier[$idField]; $types[] = $this->class->fieldMappings[$idField]['type']; $where[] = $this->quoteStrategy->getColumnName($idField, $this->class, $this->platform); continue; } $params[] = $identifier[$idField]; $where[] = $this->quoteStrategy->getJoinColumnName($this->class->associationMappings[$idField]['joinColumns'][0], $this->class, $this->platform); $targetMapping = $this->em->getClassMetadata($this->class->associationMappings[$idField]['targetEntity']); $targetType = PersisterHelper::getTypeOfField($targetMapping->identifier[0], $targetMapping, $this->em); if ($targetType === []) { throw ORMException::unrecognizedField($targetMapping->identifier[0]); } $types[] = reset($targetType); } if ($versioned) { $versionField = $this->class->versionField; $versionFieldType = $this->class->fieldMappings[$versionField]['type']; $versionColumn = $this->quoteStrategy->getColumnName($versionField, $this->class, $this->platform); $where[] = $versionColumn; $types[] = $this->class->fieldMappings[$versionField]['type']; $params[] = $this->class->reflFields[$versionField]->getValue($entity); switch ($versionFieldType) { case Type::SMALLINT: case Type::INTEGER: case Type::BIGINT: $set[] = $versionColumn . ' = ' . $versionColumn . ' + 1'; break; case Type::DATETIME: $set[] = $versionColumn . ' = CURRENT_TIMESTAMP'; break; } } $sql = 'UPDATE ' . $quotedTableName . ' SET ' . implode(', ', $set) . ' WHERE ' . implode(' = ? AND ', $where) . ' = ?'; $result = $this->conn->executeUpdate($sql, $params, $types); if ($versioned && !$result) { throw OptimisticLockException::lockFailed($entity); } } protected function deleteJoinTableRecords(array $identifier, array $types) : void { foreach ($this->class->associationMappings as $mapping) { if ($mapping['type'] !== ClassMetadata::MANY_TO_MANY) { continue; } $selfReferential = $mapping['targetEntity'] === $mapping['sourceEntity']; $class = $this->class; $association = $mapping; $otherColumns = []; $otherKeys = []; $keys = []; if (!$mapping['isOwningSide']) { $class = $this->em->getClassMetadata($mapping['targetEntity']); $association = $class->associationMappings[$mapping['mappedBy']]; } $joinColumns = $mapping['isOwningSide'] ? $association['joinTable']['joinColumns'] : $association['joinTable']['inverseJoinColumns']; if ($selfReferential) { $otherColumns = !$mapping['isOwningSide'] ? $association['joinTable']['joinColumns'] : $association['joinTable']['inverseJoinColumns']; } foreach ($joinColumns as $joinColumn) { $keys[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); } foreach ($otherColumns as $joinColumn) { $otherKeys[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); } if (isset($mapping['isOnDeleteCascade'])) { continue; } $joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->class, $this->platform); $this->conn->delete($joinTableName, array_combine($keys, $identifier), $types); if ($selfReferential) { $this->conn->delete($joinTableName, array_combine($otherKeys, $identifier), $types); } } } public function delete($entity) { $class = $this->class; $identifier = $this->em->getUnitOfWork()->getEntityIdentifier($entity); $tableName = $this->quoteStrategy->getTableName($class, $this->platform); $idColumns = $this->quoteStrategy->getIdentifierColumnNames($class, $this->platform); $id = array_combine($idColumns, $identifier); $types = $this->getClassIdentifiersTypes($class); $this->deleteJoinTableRecords($identifier, $types); return (bool) $this->conn->delete($tableName, $id, $types); } protected function prepareUpdateData($entity) { $versionField = null; $result = []; $uow = $this->em->getUnitOfWork(); $versioned = $this->class->isVersioned; if ($versioned !== \false) { $versionField = $this->class->versionField; } foreach ($uow->getEntityChangeSet($entity) as $field => $change) { if (isset($versionField) && $versionField === $field) { continue; } if (isset($this->class->embeddedClasses[$field])) { continue; } $newVal = $change[1]; if (!isset($this->class->associationMappings[$field])) { $fieldMapping = $this->class->fieldMappings[$field]; $columnName = $fieldMapping['columnName']; $this->columnTypes[$columnName] = $fieldMapping['type']; $result[$this->getOwningTable($field)][$columnName] = $newVal; continue; } $assoc = $this->class->associationMappings[$field]; if (!$assoc['isOwningSide'] || !($assoc['type'] & ClassMetadata::TO_ONE)) { continue; } if ($newVal !== null) { $oid = spl_object_hash($newVal); if (isset($this->queuedInserts[$oid]) || $uow->isScheduledForInsert($newVal)) { $uow->scheduleExtraUpdate($entity, [$field => [null, $newVal]]); $newVal = null; } } $newValId = null; if ($newVal !== null) { $newValId = $uow->getEntityIdentifier($newVal); } $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); $owningTable = $this->getOwningTable($field); foreach ($assoc['joinColumns'] as $joinColumn) { $sourceColumn = $joinColumn['name']; $targetColumn = $joinColumn['referencedColumnName']; $quotedColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $this->quotedColumns[$sourceColumn] = $quotedColumn; $this->columnTypes[$sourceColumn] = PersisterHelper::getTypeOfColumn($targetColumn, $targetClass, $this->em); $result[$owningTable][$sourceColumn] = $newValId ? $newValId[$targetClass->getFieldForColumn($targetColumn)] : null; } } return $result; } protected function prepareInsertData($entity) { return $this->prepareUpdateData($entity); } public function getOwningTable($fieldName) { return $this->class->getTableName(); } public function load(array $criteria, $entity = null, $assoc = null, array $hints = [], $lockMode = null, $limit = null, ?array $orderBy = null) { $this->switchPersisterContext(null, $limit); $sql = $this->getSelectSQL($criteria, $assoc, $lockMode, $limit, null, $orderBy); [$params, $types] = $this->expandParameters($criteria); $stmt = $this->conn->executeQuery($sql, $params, $types); if ($entity !== null) { $hints[Query::HINT_REFRESH] = \true; $hints[Query::HINT_REFRESH_ENTITY] = $entity; } $hydrator = $this->em->newHydrator($this->currentPersisterContext->selectJoinSql ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT); $entities = $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, $hints); return $entities ? $entities[0] : null; } public function loadById(array $identifier, $entity = null) { return $this->load($identifier, $entity); } public function loadOneToOneEntity(array $assoc, $sourceEntity, array $identifier = []) { $foundEntity = $this->em->getUnitOfWork()->tryGetById($identifier, $assoc['targetEntity']); if ($foundEntity !== \false) { return $foundEntity; } $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); if ($assoc['isOwningSide']) { $isInverseSingleValued = $assoc['inversedBy'] && !$targetClass->isCollectionValuedAssociation($assoc['inversedBy']); $hints = []; if ($isInverseSingleValued) { $hints['fetched']['r'][$assoc['inversedBy']] = \true; } $targetEntity = $this->load($identifier, null, $assoc, $hints); if ($targetEntity !== null && $isInverseSingleValued) { $targetClass->reflFields[$assoc['inversedBy']]->setValue($targetEntity, $sourceEntity); } return $targetEntity; } $sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']); $owningAssoc = $targetClass->getAssociationMapping($assoc['mappedBy']); $computedIdentifier = []; foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) { if (!isset($sourceClass->fieldNames[$sourceKeyColumn])) { throw MappingException::joinColumnMustPointToMappedField($sourceClass->name, $sourceKeyColumn); } $computedIdentifier[$targetClass->getFieldForColumn($targetKeyColumn)] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity); } $targetEntity = $this->load($computedIdentifier, null, $assoc); if ($targetEntity !== null) { $targetClass->setFieldValue($targetEntity, $assoc['mappedBy'], $sourceEntity); } return $targetEntity; } public function refresh(array $id, $entity, $lockMode = null) { $sql = $this->getSelectSQL($id, null, $lockMode); [$params, $types] = $this->expandParameters($id); $stmt = $this->conn->executeQuery($sql, $params, $types); $hydrator = $this->em->newHydrator(Query::HYDRATE_OBJECT); $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [Query::HINT_REFRESH => \true]); } public function count($criteria = []) { $sql = $this->getCountSQL($criteria); [$params, $types] = $criteria instanceof Criteria ? $this->expandCriteriaParameters($criteria) : $this->expandParameters($criteria); return (int) $this->conn->executeQuery($sql, $params, $types)->fetchColumn(); } public function loadCriteria(Criteria $criteria) { $orderBy = $criteria->getOrderings(); $limit = $criteria->getMaxResults(); $offset = $criteria->getFirstResult(); $query = $this->getSelectSQL($criteria, null, null, $limit, $offset, $orderBy); [$params, $types] = $this->expandCriteriaParameters($criteria); $stmt = $this->conn->executeQuery($query, $params, $types); $hydrator = $this->em->newHydrator($this->currentPersisterContext->selectJoinSql ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT); return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [UnitOfWork::HINT_DEFEREAGERLOAD => \true]); } public function expandCriteriaParameters(Criteria $criteria) { $expression = $criteria->getWhereExpression(); $sqlParams = []; $sqlTypes = []; if ($expression === null) { return [$sqlParams, $sqlTypes]; } $valueVisitor = new SqlValueVisitor(); $valueVisitor->dispatch($expression); [$params, $types] = $valueVisitor->getParamsAndTypes(); foreach ($params as $param) { $sqlParams = array_merge($sqlParams, $this->getValues($param)); } foreach ($types as $type) { [$field, $value] = $type; $sqlTypes = array_merge($sqlTypes, $this->getTypes($field, $value, $this->class)); } return [$sqlParams, $sqlTypes]; } public function loadAll(array $criteria = [], ?array $orderBy = null, $limit = null, $offset = null) { $this->switchPersisterContext($offset, $limit); $sql = $this->getSelectSQL($criteria, null, null, $limit, $offset, $orderBy); [$params, $types] = $this->expandParameters($criteria); $stmt = $this->conn->executeQuery($sql, $params, $types); $hydrator = $this->em->newHydrator($this->currentPersisterContext->selectJoinSql ? Query::HYDRATE_OBJECT : Query::HYDRATE_SIMPLEOBJECT); return $hydrator->hydrateAll($stmt, $this->currentPersisterContext->rsm, [UnitOfWork::HINT_DEFEREAGERLOAD => \true]); } public function getManyToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null) { $this->switchPersisterContext($offset, $limit); $stmt = $this->getManyToManyStatement($assoc, $sourceEntity, $offset, $limit); return $this->loadArrayFromStatement($assoc, $stmt); } private function loadArrayFromStatement(array $assoc, DriverStatement $stmt) : array { $rsm = $this->currentPersisterContext->rsm; $hints = [UnitOfWork::HINT_DEFEREAGERLOAD => \true]; if (isset($assoc['indexBy'])) { $rsm = clone $this->currentPersisterContext->rsm; $rsm->addIndexBy('r', $assoc['indexBy']); } return $this->em->newHydrator(Query::HYDRATE_OBJECT)->hydrateAll($stmt, $rsm, $hints); } private function loadCollectionFromStatement(array $assoc, DriverStatement $stmt, PersistentCollection $coll) : array { $rsm = $this->currentPersisterContext->rsm; $hints = [UnitOfWork::HINT_DEFEREAGERLOAD => \true, 'collection' => $coll]; if (isset($assoc['indexBy'])) { $rsm = clone $this->currentPersisterContext->rsm; $rsm->addIndexBy('r', $assoc['indexBy']); } return $this->em->newHydrator(Query::HYDRATE_OBJECT)->hydrateAll($stmt, $rsm, $hints); } public function loadManyToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection) { $stmt = $this->getManyToManyStatement($assoc, $sourceEntity); return $this->loadCollectionFromStatement($assoc, $stmt, $collection); } private function getManyToManyStatement(array $assoc, $sourceEntity, ?int $offset = null, ?int $limit = null) { $this->switchPersisterContext($offset, $limit); $sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']); $class = $sourceClass; $association = $assoc; $criteria = []; $parameters = []; if (!$assoc['isOwningSide']) { $class = $this->em->getClassMetadata($assoc['targetEntity']); $association = $class->associationMappings[$assoc['mappedBy']]; } $joinColumns = $assoc['isOwningSide'] ? $association['joinTable']['joinColumns'] : $association['joinTable']['inverseJoinColumns']; $quotedJoinTable = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform); foreach ($joinColumns as $joinColumn) { $sourceKeyColumn = $joinColumn['referencedColumnName']; $quotedKeyColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); switch (\true) { case $sourceClass->containsForeignIdentifier: $field = $sourceClass->getFieldForColumn($sourceKeyColumn); $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); if (isset($sourceClass->associationMappings[$field])) { $value = $this->em->getUnitOfWork()->getEntityIdentifier($value); $value = $value[$this->em->getClassMetadata($sourceClass->associationMappings[$field]['targetEntity'])->identifier[0]]; } break; case isset($sourceClass->fieldNames[$sourceKeyColumn]): $field = $sourceClass->fieldNames[$sourceKeyColumn]; $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); break; default: throw MappingException::joinColumnMustPointToMappedField($sourceClass->name, $sourceKeyColumn); } $criteria[$quotedJoinTable . '.' . $quotedKeyColumn] = $value; $parameters[] = ['value' => $value, 'field' => $field, 'class' => $sourceClass]; } $sql = $this->getSelectSQL($criteria, $assoc, null, $limit, $offset); [$params, $types] = $this->expandToManyParameters($parameters); return $this->conn->executeQuery($sql, $params, $types); } public function getSelectSQL($criteria, $assoc = null, $lockMode = null, $limit = null, $offset = null, ?array $orderBy = null) { $this->switchPersisterContext($offset, $limit); $lockSql = ''; $joinSql = ''; $orderBySql = ''; if ($assoc !== null && $assoc['type'] === ClassMetadata::MANY_TO_MANY) { $joinSql = $this->getSelectManyToManyJoinSQL($assoc); } if (isset($assoc['orderBy'])) { $orderBy = $assoc['orderBy']; } if ($orderBy) { $orderBySql = $this->getOrderBySQL($orderBy, $this->getSQLTableAlias($this->class->name)); } $conditionSql = $criteria instanceof Criteria ? $this->getSelectConditionCriteriaSQL($criteria) : $this->getSelectConditionSQL($criteria, $assoc); switch ($lockMode) { case LockMode::PESSIMISTIC_READ: $lockSql = ' ' . $this->platform->getReadLockSQL(); break; case LockMode::PESSIMISTIC_WRITE: $lockSql = ' ' . $this->platform->getWriteLockSQL(); break; } $columnList = $this->getSelectColumnsSQL(); $tableAlias = $this->getSQLTableAlias($this->class->name); $filterSql = $this->generateFilterConditionSQL($this->class, $tableAlias); $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform); if ($filterSql !== '') { $conditionSql = $conditionSql ? $conditionSql . ' AND ' . $filterSql : $filterSql; } $select = 'SELECT ' . $columnList; $from = ' FROM ' . $tableName . ' ' . $tableAlias; $join = $this->currentPersisterContext->selectJoinSql . $joinSql; $where = $conditionSql ? ' WHERE ' . $conditionSql : ''; $lock = $this->platform->appendLockHint($from, $lockMode); $query = $select . $lock . $join . $where . $orderBySql; return $this->platform->modifyLimitQuery($query, $limit, $offset) . $lockSql; } public function getCountSQL($criteria = []) { $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform); $tableAlias = $this->getSQLTableAlias($this->class->name); $conditionSql = $criteria instanceof Criteria ? $this->getSelectConditionCriteriaSQL($criteria) : $this->getSelectConditionSQL($criteria); $filterSql = $this->generateFilterConditionSQL($this->class, $tableAlias); if ($filterSql !== '') { $conditionSql = $conditionSql ? $conditionSql . ' AND ' . $filterSql : $filterSql; } return 'SELECT COUNT(*) ' . 'FROM ' . $tableName . ' ' . $tableAlias . (empty($conditionSql) ? '' : ' WHERE ' . $conditionSql); } protected final function getOrderBySQL(array $orderBy, string $baseTableAlias) : string { $orderByList = []; foreach ($orderBy as $fieldName => $orientation) { $orientation = strtoupper(trim($orientation)); if ($orientation !== 'ASC' && $orientation !== 'DESC') { throw ORMException::invalidOrientation($this->class->name, $fieldName); } if (isset($this->class->fieldMappings[$fieldName])) { $tableAlias = isset($this->class->fieldMappings[$fieldName]['inherited']) ? $this->getSQLTableAlias($this->class->fieldMappings[$fieldName]['inherited']) : $baseTableAlias; $columnName = $this->quoteStrategy->getColumnName($fieldName, $this->class, $this->platform); $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; continue; } if (isset($this->class->associationMappings[$fieldName])) { if (!$this->class->associationMappings[$fieldName]['isOwningSide']) { throw ORMException::invalidFindByInverseAssociation($this->class->name, $fieldName); } $tableAlias = isset($this->class->associationMappings[$fieldName]['inherited']) ? $this->getSQLTableAlias($this->class->associationMappings[$fieldName]['inherited']) : $baseTableAlias; foreach ($this->class->associationMappings[$fieldName]['joinColumns'] as $joinColumn) { $columnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $orderByList[] = $tableAlias . '.' . $columnName . ' ' . $orientation; } continue; } throw ORMException::unrecognizedField($fieldName); } return ' ORDER BY ' . implode(', ', $orderByList); } protected function getSelectColumnsSQL() { if ($this->currentPersisterContext->selectColumnListSql !== null) { return $this->currentPersisterContext->selectColumnListSql; } $columnList = []; $this->currentPersisterContext->rsm->addEntityResult($this->class->name, 'r'); foreach ($this->class->fieldNames as $field) { $columnList[] = $this->getSelectColumnSQL($field, $this->class); } $this->currentPersisterContext->selectJoinSql = ''; $eagerAliasCounter = 0; foreach ($this->class->associationMappings as $assocField => $assoc) { $assocColumnSQL = $this->getSelectColumnAssociationSQL($assocField, $assoc, $this->class); if ($assocColumnSQL) { $columnList[] = $assocColumnSQL; } $isAssocToOneInverseSide = $assoc['type'] & ClassMetadata::TO_ONE && !$assoc['isOwningSide']; $isAssocFromOneEager = $assoc['type'] !== ClassMetadata::MANY_TO_MANY && $assoc['fetch'] === ClassMetadata::FETCH_EAGER; if (!($isAssocFromOneEager || $isAssocToOneInverseSide)) { continue; } if (($assoc['type'] & ClassMetadata::TO_MANY) > 0 && $this->currentPersisterContext->handlesLimits) { continue; } $eagerEntity = $this->em->getClassMetadata($assoc['targetEntity']); if ($eagerEntity->inheritanceType !== ClassMetadata::INHERITANCE_TYPE_NONE) { continue; } $assocAlias = 'e' . $eagerAliasCounter++; $this->currentPersisterContext->rsm->addJoinedEntityResult($assoc['targetEntity'], $assocAlias, 'r', $assocField); foreach ($eagerEntity->fieldNames as $field) { $columnList[] = $this->getSelectColumnSQL($field, $eagerEntity, $assocAlias); } foreach ($eagerEntity->associationMappings as $eagerAssocField => $eagerAssoc) { $eagerAssocColumnSQL = $this->getSelectColumnAssociationSQL($eagerAssocField, $eagerAssoc, $eagerEntity, $assocAlias); if ($eagerAssocColumnSQL) { $columnList[] = $eagerAssocColumnSQL; } } $association = $assoc; $joinCondition = []; if (isset($assoc['indexBy'])) { $this->currentPersisterContext->rsm->addIndexBy($assocAlias, $assoc['indexBy']); } if (!$assoc['isOwningSide']) { $eagerEntity = $this->em->getClassMetadata($assoc['targetEntity']); $association = $eagerEntity->getAssociationMapping($assoc['mappedBy']); } $joinTableAlias = $this->getSQLTableAlias($eagerEntity->name, $assocAlias); $joinTableName = $this->quoteStrategy->getTableName($eagerEntity, $this->platform); if ($assoc['isOwningSide']) { $tableAlias = $this->getSQLTableAlias($association['targetEntity'], $assocAlias); $this->currentPersisterContext->selectJoinSql .= ' ' . $this->getJoinSQLForJoinColumns($association['joinColumns']); foreach ($association['joinColumns'] as $joinColumn) { $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity']) . '.' . $sourceCol . ' = ' . $tableAlias . '.' . $targetCol; } $filterSql = $this->generateFilterConditionSQL($eagerEntity, $tableAlias); if ($filterSql) { $joinCondition[] = $filterSql; } } else { $this->currentPersisterContext->selectJoinSql .= ' LEFT JOIN'; foreach ($association['joinColumns'] as $joinColumn) { $sourceCol = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $targetCol = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); $joinCondition[] = $this->getSQLTableAlias($association['sourceEntity'], $assocAlias) . '.' . $sourceCol . ' = ' . $this->getSQLTableAlias($association['targetEntity']) . '.' . $targetCol; } } $this->currentPersisterContext->selectJoinSql .= ' ' . $joinTableName . ' ' . $joinTableAlias . ' ON '; $this->currentPersisterContext->selectJoinSql .= implode(' AND ', $joinCondition); } $this->currentPersisterContext->selectColumnListSql = implode(', ', $columnList); return $this->currentPersisterContext->selectColumnListSql; } protected function getSelectColumnAssociationSQL($field, $assoc, ClassMetadata $class, $alias = 'r') { if (!($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { return ''; } $columnList = []; $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); $isIdentifier = isset($assoc['id']) && $assoc['id'] === \true; $sqlTableAlias = $this->getSQLTableAlias($class->name, $alias === 'r' ? '' : $alias); foreach ($assoc['joinColumns'] as $joinColumn) { $quotedColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $resultColumnName = $this->getSQLColumnAlias($joinColumn['name']); $type = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); $this->currentPersisterContext->rsm->addMetaResult($alias, $resultColumnName, $joinColumn['name'], $isIdentifier, $type); $columnList[] = sprintf('%s.%s AS %s', $sqlTableAlias, $quotedColumn, $resultColumnName); } return implode(', ', $columnList); } protected function getSelectManyToManyJoinSQL(array $manyToMany) { $conditions = []; $association = $manyToMany; $sourceTableAlias = $this->getSQLTableAlias($this->class->name); if (!$manyToMany['isOwningSide']) { $targetEntity = $this->em->getClassMetadata($manyToMany['targetEntity']); $association = $targetEntity->associationMappings[$manyToMany['mappedBy']]; } $joinTableName = $this->quoteStrategy->getJoinTableName($association, $this->class, $this->platform); $joinColumns = $manyToMany['isOwningSide'] ? $association['joinTable']['inverseJoinColumns'] : $association['joinTable']['joinColumns']; foreach ($joinColumns as $joinColumn) { $quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); $quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $this->class, $this->platform); $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableName . '.' . $quotedSourceColumn; } return ' INNER JOIN ' . $joinTableName . ' ON ' . implode(' AND ', $conditions); } public function getInsertSQL() { if ($this->insertSql !== null) { return $this->insertSql; } $columns = $this->getInsertColumnList(); $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform); if (empty($columns)) { $identityColumn = $this->quoteStrategy->getColumnName($this->class->identifier[0], $this->class, $this->platform); $this->insertSql = $this->platform->getEmptyIdentityInsertSQL($tableName, $identityColumn); return $this->insertSql; } $values = []; $columns = array_unique($columns); foreach ($columns as $column) { $placeholder = '?'; if (isset($this->class->fieldNames[$column]) && isset($this->columnTypes[$this->class->fieldNames[$column]]) && isset($this->class->fieldMappings[$this->class->fieldNames[$column]]['requireSQLConversion'])) { $type = Type::getType($this->columnTypes[$this->class->fieldNames[$column]]); $placeholder = $type->convertToDatabaseValueSQL('?', $this->platform); } $values[] = $placeholder; } $columns = implode(', ', $columns); $values = implode(', ', $values); $this->insertSql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $tableName, $columns, $values); return $this->insertSql; } protected function getInsertColumnList() { $columns = []; foreach ($this->class->reflFields as $name => $field) { if ($this->class->isVersioned && $this->class->versionField === $name) { continue; } if (isset($this->class->embeddedClasses[$name])) { continue; } if (isset($this->class->associationMappings[$name])) { $assoc = $this->class->associationMappings[$name]; if ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) { foreach ($assoc['joinColumns'] as $joinColumn) { $columns[] = $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); } } continue; } if (!$this->class->isIdGeneratorIdentity() || $this->class->identifier[0] !== $name) { $columns[] = $this->quoteStrategy->getColumnName($name, $this->class, $this->platform); $this->columnTypes[$name] = $this->class->fieldMappings[$name]['type']; } } return $columns; } protected function getSelectColumnSQL($field, ClassMetadata $class, $alias = 'r') { $root = $alias === 'r' ? '' : $alias; $tableAlias = $this->getSQLTableAlias($class->name, $root); $fieldMapping = $class->fieldMappings[$field]; $sql = sprintf('%s.%s', $tableAlias, $this->quoteStrategy->getColumnName($field, $class, $this->platform)); $columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); $this->currentPersisterContext->rsm->addFieldResult($alias, $columnAlias, $field); if (isset($fieldMapping['requireSQLConversion'])) { $type = Type::getType($fieldMapping['type']); $sql = $type->convertToPHPValueSQL($sql, $this->platform); } return $sql . ' AS ' . $columnAlias; } protected function getSQLTableAlias($className, $assocName = '') { if ($assocName) { $className .= '#' . $assocName; } if (isset($this->currentPersisterContext->sqlTableAliases[$className])) { return $this->currentPersisterContext->sqlTableAliases[$className]; } $tableAlias = 't' . $this->currentPersisterContext->sqlAliasCounter++; $this->currentPersisterContext->sqlTableAliases[$className] = $tableAlias; return $tableAlias; } public function lock(array $criteria, $lockMode) { $lockSql = ''; $conditionSql = $this->getSelectConditionSQL($criteria); switch ($lockMode) { case LockMode::PESSIMISTIC_READ: $lockSql = $this->platform->getReadLockSQL(); break; case LockMode::PESSIMISTIC_WRITE: $lockSql = $this->platform->getWriteLockSQL(); break; } $lock = $this->getLockTablesSql($lockMode); $where = ($conditionSql ? ' WHERE ' . $conditionSql : '') . ' '; $sql = 'SELECT 1 ' . $lock . $where . $lockSql; [$params, $types] = $this->expandParameters($criteria); $this->conn->executeQuery($sql, $params, $types); } protected function getLockTablesSql($lockMode) { return $this->platform->appendLockHint('FROM ' . $this->quoteStrategy->getTableName($this->class, $this->platform) . ' ' . $this->getSQLTableAlias($this->class->name), $lockMode); } protected function getSelectConditionCriteriaSQL(Criteria $criteria) { $expression = $criteria->getWhereExpression(); if ($expression === null) { return ''; } $visitor = new SqlExpressionVisitor($this, $this->class); return $visitor->dispatch($expression); } public function getSelectConditionStatementSQL($field, $value, $assoc = null, $comparison = null) { $selectedColumns = []; $columns = $this->getSelectConditionStatementColumnSQL($field, $assoc); if (count($columns) > 1 && $comparison === Comparison::IN) { throw ORMException::cantUseInOperatorOnCompositeKeys(); } foreach ($columns as $column) { $placeholder = '?'; if (isset($this->class->fieldMappings[$field]['requireSQLConversion'])) { $type = Type::getType($this->class->fieldMappings[$field]['type']); $placeholder = $type->convertToDatabaseValueSQL($placeholder, $this->platform); } if ($comparison !== null) { if (($comparison === Comparison::EQ || $comparison === Comparison::IS) && $value === null) { $selectedColumns[] = $column . ' IS NULL'; continue; } if ($comparison === Comparison::NEQ && $value === null) { $selectedColumns[] = $column . ' IS NOT NULL'; continue; } $selectedColumns[] = $column . ' ' . sprintf(self::$comparisonMap[$comparison], $placeholder); continue; } if (is_array($value)) { $in = sprintf('%s IN (%s)', $column, $placeholder); if (array_search(null, $value, \true) !== \false) { $selectedColumns[] = sprintf('(%s OR %s IS NULL)', $in, $column); continue; } $selectedColumns[] = $in; continue; } if ($value === null) { $selectedColumns[] = sprintf('%s IS NULL', $column); continue; } $selectedColumns[] = sprintf('%s = %s', $column, $placeholder); } return implode(' AND ', $selectedColumns); } private function getSelectConditionStatementColumnSQL(string $field, ?array $assoc = null) : array { if (isset($this->class->fieldMappings[$field])) { $className = $this->class->fieldMappings[$field]['inherited'] ?? $this->class->name; return [$this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getColumnName($field, $this->class, $this->platform)]; } if (isset($this->class->associationMappings[$field])) { $association = $this->class->associationMappings[$field]; $columns = []; $class = $this->class; if ($association['type'] === ClassMetadata::MANY_TO_MANY) { if (!$association['isOwningSide']) { $association = $assoc; } $joinTableName = $this->quoteStrategy->getJoinTableName($association, $class, $this->platform); $joinColumns = $assoc['isOwningSide'] ? $association['joinTable']['joinColumns'] : $association['joinTable']['inverseJoinColumns']; foreach ($joinColumns as $joinColumn) { $columns[] = $joinTableName . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); } } else { if (!$association['isOwningSide']) { throw ORMException::invalidFindByInverseAssociation($this->class->name, $field); } $className = $association['inherited'] ?? $this->class->name; foreach ($association['joinColumns'] as $joinColumn) { $columns[] = $this->getSQLTableAlias($className) . '.' . $this->quoteStrategy->getJoinColumnName($joinColumn, $this->class, $this->platform); } } return $columns; } if ($assoc !== null && strpos($field, ' ') === \false && strpos($field, '(') === \false) { return [$field]; } throw ORMException::unrecognizedField($field); } protected function getSelectConditionSQL(array $criteria, $assoc = null) { $conditions = []; foreach ($criteria as $field => $value) { $conditions[] = $this->getSelectConditionStatementSQL($field, $value, $assoc); } return implode(' AND ', $conditions); } public function getOneToManyCollection(array $assoc, $sourceEntity, $offset = null, $limit = null) { $this->switchPersisterContext($offset, $limit); $stmt = $this->getOneToManyStatement($assoc, $sourceEntity, $offset, $limit); return $this->loadArrayFromStatement($assoc, $stmt); } public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $collection) { $stmt = $this->getOneToManyStatement($assoc, $sourceEntity); return $this->loadCollectionFromStatement($assoc, $stmt, $collection); } private function getOneToManyStatement(array $assoc, $sourceEntity, ?int $offset = null, ?int $limit = null) : DriverStatement { $this->switchPersisterContext($offset, $limit); $criteria = []; $parameters = []; $owningAssoc = $this->class->associationMappings[$assoc['mappedBy']]; $sourceClass = $this->em->getClassMetadata($assoc['sourceEntity']); $tableAlias = $this->getSQLTableAlias($owningAssoc['inherited'] ?? $this->class->name); foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) { if ($sourceClass->containsForeignIdentifier) { $field = $sourceClass->getFieldForColumn($sourceKeyColumn); $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); if (isset($sourceClass->associationMappings[$field])) { $value = $this->em->getUnitOfWork()->getEntityIdentifier($value); $value = $value[$this->em->getClassMetadata($sourceClass->associationMappings[$field]['targetEntity'])->identifier[0]]; } $criteria[$tableAlias . '.' . $targetKeyColumn] = $value; $parameters[] = ['value' => $value, 'field' => $field, 'class' => $sourceClass]; continue; } $field = $sourceClass->fieldNames[$sourceKeyColumn]; $value = $sourceClass->reflFields[$field]->getValue($sourceEntity); $criteria[$tableAlias . '.' . $targetKeyColumn] = $value; $parameters[] = ['value' => $value, 'field' => $field, 'class' => $sourceClass]; } $sql = $this->getSelectSQL($criteria, $assoc, null, $limit, $offset); [$params, $types] = $this->expandToManyParameters($parameters); return $this->conn->executeQuery($sql, $params, $types); } public function expandParameters($criteria) { $params = []; $types = []; foreach ($criteria as $field => $value) { if ($value === null) { continue; } $types = array_merge($types, $this->getTypes($field, $value, $this->class)); $params = array_merge($params, $this->getValues($value)); } return [$params, $types]; } private function expandToManyParameters(array $criteria) : array { $params = []; $types = []; foreach ($criteria as $criterion) { if ($criterion['value'] === null) { continue; } $types = array_merge($types, $this->getTypes($criterion['field'], $criterion['value'], $criterion['class'])); $params = array_merge($params, $this->getValues($criterion['value'])); } return [$params, $types]; } private function getTypes(string $field, $value, ClassMetadata $class) : array { $types = []; switch (\true) { case isset($class->fieldMappings[$field]): $types = array_merge($types, [$class->fieldMappings[$field]['type']]); break; case isset($class->associationMappings[$field]): $assoc = $class->associationMappings[$field]; $class = $this->em->getClassMetadata($assoc['targetEntity']); if (!$assoc['isOwningSide']) { $assoc = $class->associationMappings[$assoc['mappedBy']]; $class = $this->em->getClassMetadata($assoc['targetEntity']); } $columns = $assoc['type'] === ClassMetadata::MANY_TO_MANY ? $assoc['relationToTargetKeyColumns'] : $assoc['sourceToTargetKeyColumns']; foreach ($columns as $column) { $types[] = PersisterHelper::getTypeOfColumn($column, $class, $this->em); } break; default: $types[] = null; break; } if (is_array($value)) { return array_map(static function ($type) { $type = Type::getType($type); return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET; }, $types); } return $types; } private function getValues($value) : array { if (is_array($value)) { $newValue = []; foreach ($value as $itemValue) { $newValue = array_merge($newValue, $this->getValues($itemValue)); } return [$newValue]; } if (is_object($value) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) { $class = $this->em->getClassMetadata(get_class($value)); if ($class->isIdentifierComposite) { $newValue = []; foreach ($class->getIdentifierValues($value) as $innerValue) { $newValue = array_merge($newValue, $this->getValues($innerValue)); } return $newValue; } } return [$this->getIndividualValue($value)]; } private function getIndividualValue($value) { if (!is_object($value) || !$this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) { return $value; } return $this->em->getUnitOfWork()->getSingleIdentifierValue($value); } public function exists($entity, ?Criteria $extraConditions = null) { $criteria = $this->class->getIdentifierValues($entity); if (!$criteria) { return \false; } $alias = $this->getSQLTableAlias($this->class->name); $sql = 'SELECT 1 ' . $this->getLockTablesSql(null) . ' WHERE ' . $this->getSelectConditionSQL($criteria); [$params, $types] = $this->expandParameters($criteria); if ($extraConditions !== null) { $sql .= ' AND ' . $this->getSelectConditionCriteriaSQL($extraConditions); [$criteriaParams, $criteriaTypes] = $this->expandCriteriaParameters($extraConditions); $params = array_merge($params, $criteriaParams); $types = array_merge($types, $criteriaTypes); } $filterSql = $this->generateFilterConditionSQL($this->class, $alias); if ($filterSql) { $sql .= ' AND ' . $filterSql; } return (bool) $this->conn->fetchColumn($sql, $params, 0, $types); } protected function getJoinSQLForJoinColumns($joinColumns) { foreach ($joinColumns as $joinColumn) { if (!isset($joinColumn['nullable']) || $joinColumn['nullable']) { return 'LEFT JOIN'; } } return 'INNER JOIN'; } public function getSQLColumnAlias($columnName) { return $this->quoteStrategy->getColumnAlias($columnName, $this->currentPersisterContext->sqlAliasCounter++, $this->platform); } protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias) { $filterClauses = []; foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias); if ($filterExpr !== '') { $filterClauses[] = '(' . $filterExpr . ')'; } } $sql = implode(' AND ', $filterClauses); return $sql ? '(' . $sql . ')' : ''; } protected function switchPersisterContext($offset, $limit) { if ($offset === null && $limit === null) { $this->currentPersisterContext = $this->noLimitsContext; return; } $this->currentPersisterContext = $this->limitsHandlingContext; } protected function getClassIdentifiersTypes(ClassMetadata $class) : array { $entityManager = $this->em; return array_map(static function ($fieldName) use($class, $entityManager) : string { $types = PersisterHelper::getTypeOfField($fieldName, $class, $entityManager); assert(isset($types[0])); return $types[0]; }, $class->identifier); } } 
<?php
 namespace MailPoetVendor\Doctrine\ORM; if (!defined('ABSPATH')) exit; use BadMethodCallException; use MailPoetVendor\Doctrine\Common\Collections\Collection; use MailPoetVendor\Doctrine\Common\Collections\Criteria; use MailPoetVendor\Doctrine\Common\Collections\Selectable; use MailPoetVendor\Doctrine\Deprecations\Deprecation; use MailPoetVendor\Doctrine\Inflector\Inflector; use MailPoetVendor\Doctrine\Inflector\InflectorFactory; use MailPoetVendor\Doctrine\ORM\Mapping\ClassMetadata; use MailPoetVendor\Doctrine\ORM\Query\ResultSetMappingBuilder; use MailPoetVendor\Doctrine\Persistence\ObjectRepository; use function array_slice; use function lcfirst; use function sprintf; use function strpos; use function substr; class EntityRepository implements ObjectRepository, Selectable { protected $_entityName; protected $_em; protected $_class; private static $inflector; public function __construct(EntityManagerInterface $em, Mapping\ClassMetadata $class) { $this->_entityName = $class->name; $this->_em = $em; $this->_class = $class; } public function createQueryBuilder($alias, $indexBy = null) { return $this->_em->createQueryBuilder()->select($alias)->from($this->_entityName, $alias, $indexBy); } public function createResultSetMappingBuilder($alias) { $rsm = new ResultSetMappingBuilder($this->_em, ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); $rsm->addRootEntityFromClassMetadata($this->_entityName, $alias); return $rsm; } public function createNamedQuery($queryName) { Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/issues/8592', 'Named Queries are deprecated, here "%s" on entity %s. Move the query logic into EntityRepository', $queryName, $this->_class->name); return $this->_em->createQuery($this->_class->getNamedQuery($queryName)); } public function createNativeNamedQuery($queryName) { Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/issues/8592', 'Named Native Queries are deprecated, here "%s" on entity %s. Move the query logic into EntityRepository', $queryName, $this->_class->name); $queryMapping = $this->_class->getNamedNativeQuery($queryName); $rsm = new Query\ResultSetMappingBuilder($this->_em); $rsm->addNamedNativeQueryMapping($this->_class, $queryMapping); return $this->_em->createNativeQuery($queryMapping['query'], $rsm); } public function clear() { Deprecation::trigger('doctrine/orm', 'https://github.com/doctrine/orm/issues/8460', 'Calling %s() is deprecated and will not be supported in Doctrine ORM 3.0.', __METHOD__); $this->_em->clear($this->_class->rootEntityName); } public function find($id, $lockMode = null, $lockVersion = null) { return $this->_em->find($this->_entityName, $id, $lockMode, $lockVersion); } public function findAll() { return $this->findBy([]); } public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null) { $persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName); return $persister->loadAll($criteria, $orderBy, $limit, $offset); } public function findOneBy(array $criteria, ?array $orderBy = null) { $persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName); return $persister->load($criteria, null, null, [], null, 1, $orderBy); } public function count(array $criteria) { return $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName)->count($criteria); } public function __call($method, $arguments) { if (strpos($method, 'findBy') === 0) { return $this->resolveMagicCall('findBy', substr($method, 6), $arguments); } if (strpos($method, 'findOneBy') === 0) { return $this->resolveMagicCall('findOneBy', substr($method, 9), $arguments); } if (strpos($method, 'countBy') === 0) { return $this->resolveMagicCall('count', substr($method, 7), $arguments); } throw new BadMethodCallException(sprintf('Undefined method "%s". The method name must start with ' . 'either findBy, findOneBy or countBy!', $method)); } protected function getEntityName() { return $this->_entityName; } public function getClassName() { return $this->getEntityName(); } protected function getEntityManager() { return $this->_em; } protected function getClassMetadata() { return $this->_class; } public function matching(Criteria $criteria) { $persister = $this->_em->getUnitOfWork()->getEntityPersister($this->_entityName); return new LazyCriteriaCollection($persister, $criteria); } private function resolveMagicCall(string $method, string $by, array $arguments) { if (!$arguments) { throw ORMException::findByRequiresParameter($method . $by); } if (self::$inflector === null) { self::$inflector = InflectorFactory::create()->build(); } $fieldName = lcfirst(self::$inflector->classify($by)); if (!($this->_class->hasField($fieldName) || $this->_class->hasAssociation($fieldName))) { throw ORMException::invalidMagicCall($this->_entityName, $fieldName, $method . $by); } return $this->{$method}([$fieldName => $arguments[0]], ...array_slice($arguments, 1)); } } 
  /** @var string[] */
  protected $ignoreColumnsForUpdate = [
    'created_at',
  ];
 
  public function __construct(EntityManager $entityManager) {
    $this->entityManager = $entityManager;
    $this->classMetadata = $entityManager->getClassMetadata($this->getEntityClassName());
    $this->doctrineRepository = new DoctrineEntityRepository($this->entityManager, $this->classMetadata);
  }
 
  /**
   * @param array $criteria
   * @param array|null $orderBy
   * @param int|null $limit
   * @param int|null $offset
   * @return T[]
   */
  public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) {
    return $this->doctrineRepository->findBy($criteria, $orderBy, $limit, $offset);
  }
 
  public function countBy(array $criteria): int {
    return $this->doctrineRepository->count($criteria);
  }
 
  /**
   * @param array $criteria
   * @param array|null $orderBy
   * @return T|null
   */
  public function findOneBy(array $criteria, array $orderBy = null) {
    return $this->doctrineRepository->findOneBy($criteria, $orderBy);
  }
 
  /**
   * @param mixed $id
   * @return T|null
   */
  public function findOneById($id) {
    }
    // this code ensures that we display the form only on a page which is related to single post
    if (!$this->wp->isSingle() && !$this->wp->isPage()) $result = $this->wp->applyFilters('mailpoet_display_form_is_single', false);
    $noFormsCache = $this->wp->getTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY);
    if ($noFormsCache === '1') $result = false;
    return $result;
  }
 
  private function saveNoForms() {
    $this->wp->setTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY, '1');
  }
 
  /**
   * @return array<string, FormEntity>
   */
  private function getForms(): array {
    $forms = $this->formsRepository->findBy([
      'deletedAt' => null,
      'status' => FormEntity::STATUS_ENABLED,
    ], ['updatedAt' => 'ASC']);
    if (count($forms) === 0) {
      $this->saveNoForms();
    }
    $forms = $this->filterOneFormInEachDisplayType($forms);
    return $forms;
  }
 
  /**
   * @param FormEntity[] $forms
   * @return array<string, FormEntity>
   */
  private function filterOneFormInEachDisplayType($forms): array {
    $formsFiltered = [];
    foreach ($forms as $form) {
      foreach (self::TYPES as $displayType) {
        if ($this->shouldDisplayFormType($form, $displayType)) {
          $formsFiltered[$displayType] = $form;
        }
      }
    }
    AssetsController $assetsController,
    TemplateRenderer $templateRenderer
  ) {
    $this->wp = $wp;
    $this->formsRepository = $formsRepository;
    $this->formRenderer = $formRenderer;
    $this->assetsController = $assetsController;
    $this->templateRenderer = $templateRenderer;
  }
 
  /**
   * This takes input from an action and any plugin or theme can pass anything.
   * We return string for regular content otherwise we just pass thru what comes.
   * @param mixed $content
   * @return string|mixed
   */
  public function display($content = null) {
    if (!is_string($content) || !$this->shouldDisplay()) return $content;
 
    $forms = $this->getForms();
    if (count($forms) === 0) {
      return $content;
    }
 
    $this->assetsController->setupFrontEndDependencies();
    $result = $content;
    foreach ($forms as $displayType => $form) {
      $result .= $this->getContentBellow($form, $displayType);
    }
    return $result;
  }
 
  private function shouldDisplay(): bool {
    $result = true;
    // This is a fix Yoast plugin and Shapely theme compatibility
    // This is to make sure we only display once for each page
    // Yast plugin calls `get_the_excerpt` which also triggers hook `the_content` we don't want to include our form in that
    // Shapely calls the hook `the_content` multiple times on the page as well and we would display popup multiple times - not ideal
    if (!$this->wp->inTheLoop() || !$this->wp->isMainQuery()) {
      $result = $this->wp->applyFilters('mailpoet_display_form_is_main_loop', false);
 
        $nesting_level = $this->nesting_level++;
 
        $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
        $num_args                           = count( $args );
 
        do {
            $this->current_priority[ $nesting_level ] = current( $this->iterations[ $nesting_level ] );
            $priority                                 = $this->current_priority[ $nesting_level ];
 
            foreach ( $this->callbacks[ $priority ] as $the_ ) {
                if ( ! $this->doing_action ) {
                    $args[0] = $value;
                }
 
                // Avoid the array_slice() if possible.
                if ( 0 == $the_['accepted_args'] ) {
                    $value = call_user_func( $the_['function'] );
                } elseif ( $the_['accepted_args'] >= $num_args ) {
                    $value = call_user_func_array( $the_['function'], $args );
                } else {
                    $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
                }
            }
        } while ( false !== next( $this->iterations[ $nesting_level ] ) );
 
        unset( $this->iterations[ $nesting_level ] );
        unset( $this->current_priority[ $nesting_level ] );
 
        $this->nesting_level--;
 
        return $value;
    }
 
    /**
     * Calls the callback functions that have been added to an action hook.
     *
     * @since 4.7.0
     *
     * @param array $args Parameters to pass to the callback functions.
        $wp_current_filter[] = $hook_name;
        _wp_call_all_hook( $args );
    }
 
    if ( ! isset( $wp_filter[ $hook_name ] ) ) {
        if ( isset( $wp_filter['all'] ) ) {
            array_pop( $wp_current_filter );
        }
 
        return $value;
    }
 
    if ( ! isset( $wp_filter['all'] ) ) {
        $wp_current_filter[] = $hook_name;
    }
 
    // Don't pass the tag name to WP_Hook.
    array_shift( $args );
 
    $filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
 
    array_pop( $wp_current_filter );
 
    return $filtered;
}
 
/**
 * Calls the callback functions that have been added to a filter hook, specifying arguments in an array.
 *
 * @since 3.0.0
 *
 * @see apply_filters() This function is identical, but the arguments passed to the
 *                      functions hooked to `$hook_name` are supplied using an array.
 *
 * @global WP_Hook[] $wp_filter         Stores all of the filters and actions.
 * @global string[]  $wp_current_filter Stores the list of current filters with the current one last.
 *
 * @param string $hook_name The name of the filter hook.
 * @param array  $args      The arguments supplied to the functions hooked to `$hook_name`.
 * @return mixed The filtered value after all hooked functions are applied to it.
        }
        if ( $form = $this->maybe_show_password_form() ) {
            return $form;
        }
        if ( $len == -1 && $page == 0 && $this->___content ) {
            return $this->___content;
        }
        $content = $this->post_content;
        if ( $len > 0 ) {
            $content = wp_trim_words($content, $len);
        }
        if ( $page ) {
            $contents = explode('<!--nextpage-->', $content);
            $page--;
            if ( count($contents) > $page ) {
                $content = $contents[$page];
            }
        }
        $content = $this->content_handle_no_teaser_block( $content );
        $content = apply_filters('the_content', ($content));
        if ( $len == -1 && $page == 0 ) {
            $this->___content = $content;
        }
        return $content;
    }
 
    /**
     * Handles for an circumstance with the Block editor where a "more" block has an option to 
     * "Hide the excerpt on the full content page" which hides everything prior to the inserted 
     * "more" block
     * @ticket #2218
     * @param string $content
     * @return string
     */
    protected function content_handle_no_teaser_block( $content ) {
        if ( strpos($content, 'noTeaser:true') !== false ) {
            $arr = explode('<!--noteaser-->', $content);
            return $arr[1];
        }
        return $content;
            if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
                return;
            }
 
            throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext());
        }
 
        if ($isDefinedTest) {
            return true;
        }
 
        if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) {
            $this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method);
        }
 
        // Some objects throw exceptions when they have __call, and the method we try
        // to call is not supported. If ignoreStrictCheck is true, we should return null.
        try {
            if (!$arguments) {
                $ret = $object->$method();
            } else {
                $ret = \call_user_func_array([$object, $method], $arguments);
            }
        } catch (\BadMethodCallException $e) {
            if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
                return;
            }
            throw $e;
        }
 
        // @deprecated in 1.28
        if ($object instanceof \Twig_TemplateInterface) {
            $self = $object->getTemplateName() === $this->getTemplateName();
            $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName());
            if ('renderBlock' === $method || 'displayBlock' === $method) {
                $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template');
            } elseif ('hasBlock' === $method) {
                $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template');
            } elseif ('render' === $method || 'display' === $method) {
                $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName());
                echo "\" class=\"post-thumbnail\" aria-hidden=\"true\">
                        <img src=\"";
                // line 39
                echo Timber\ImageHelper::resize($this->getAttribute($this->getAttribute(($context["post"] ?? null), "thumbnail", []), "src", []), $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "config", []), "get", [0 => (("content." . ($context["scope"] ?? null)) . ".featured-image.width"), 1 => "1200"], "method"), $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "config", []), "get", [0 => (("content." . ($context["scope"] ?? null)) . ".featured-image.height"), 1 => "350"], "method"));
                echo "\" class=\"featured-image tease-featured-image ";
                echo ($context["position"] ?? null);
                echo "\" alt=\"";
                echo $this->getAttribute(($context["post"] ?? null), "title", []);
                echo "\" />
                    </a>
                ";
            }
            // line 42
            echo "                ";
            // line 43
            echo "
                ";
            // line 45
            echo "                ";
            echo $this->getAttribute(($context["post"] ?? null), "content", []);
            echo "
 
                ";
            // line 47
            echo call_user_func_array($this->env->getFunction('function')->getCallable(), ["wp_link_pages", ["before" => "<div class=\"page-links\" itemprop=\"pagination\">", "after" => "</div>", "link_before" => "<span class=\"page-number page-numbers\">", "link_after" => "</span>", "echo" => 0]]);
            echo "
                ";
            // line 49
            echo "
                ";
            // line 51
            echo "                ";
            echo call_user_func_array($this->env->getFunction('function')->getCallable(), ["edit_post_link", __("Edit", "g5_helium"), "<span class=\"edit-link\">", "</span>"]);
            echo "
                ";
            // line 53
            echo "
            </section>
            ";
            // line 56
 
        if ($useBlocks && isset($blocks[$name])) {
            $template = $blocks[$name][0];
            $block = $blocks[$name][1];
        } elseif (isset($this->blocks[$name])) {
            $template = $this->blocks[$name][0];
            $block = $this->blocks[$name][1];
        } else {
            $template = null;
            $block = null;
        }
 
        // avoid RCEs when sandbox is enabled
        if (null !== $template && !$template instanceof self) {
            throw new \LogicException('A block must be a method on a \Twig\Template instance.');
        }
 
        if (null !== $template) {
            try {
                $template->$block($context, $blocks);
            } catch (Error $e) {
                if (!$e->getSourceContext()) {
                    $e->setSourceContext($template->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, $template->getSourceContext(), $e);
                $e->guess();
 
                throw $e;
            }
        } elseif (false !== $parent = $this->getParent($context)) {
            $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
 
        $this->blocks = [
            'content' => [$this, 'block_content'],
        ];
    }
 
    protected function doDisplay(array $context, array $blocks = [])
    {
        // line 1
        echo "<article class=\"post-type-";
        echo $this->getAttribute(($context["post"] ?? null), "post_type", []);
        echo " ";
        echo $this->getAttribute(($context["post"] ?? null), "class", []);
        echo "\" id=\"post-";
        echo $this->getAttribute(($context["post"] ?? null), "ID", []);
        echo "\">
 
    ";
        // line 3
        $this->displayBlock('content', $context, $blocks);
        // line 71
        echo "
</article>
";
    }
 
    // line 3
    public function block_content($context, array $blocks = [])
    {
        // line 4
        echo "
        ";
        // line 6
        echo "        <section class=\"entry-header\">
 
            ";
        // line 8
        if ($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "config", []), "get", [0 => (("content." . ($context["scope"] ?? null)) . ".title.enabled"), 1 => "1"], "method")) {
            // line 9
            echo "                ";
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } 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;
        }
    }
 
    {
        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 (\Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
        $context["twigTemplate"] = "page.html.twig";
        // line 3
        $context["scope"] = "page";
        // line 1
        $this->parent = $this->loadTemplate("partials/page.html.twig", "page.html.twig", 1);
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }
 
    // line 5
    public function block_content($context, array $blocks = [])
    {
        // line 6
        echo "
    <div class=\"platform-content\">
        <div class=\"content-wrapper\">
            <section class=\"entry\">
 
                ";
        // line 11
        $this->loadTemplate([0 => (("partials/content-" . ($context["scope"] ?? null)) . ".html.twig"), 1 => "partials/content.html.twig"], "page.html.twig", 11)->display($context);
        // line 12
        echo "
            </section>
        </div> <!-- /content-wrapper -->
    </div>
 
";
    }
 
    public function getTemplateName()
    {
        return "page.html.twig";
    }
 
    public function isTraitable()
    {
        return false;
    }
 
    public function getDebugInfo()
 
        if ($useBlocks && isset($blocks[$name])) {
            $template = $blocks[$name][0];
            $block = $blocks[$name][1];
        } elseif (isset($this->blocks[$name])) {
            $template = $this->blocks[$name][0];
            $block = $this->blocks[$name][1];
        } else {
            $template = null;
            $block = null;
        }
 
        // avoid RCEs when sandbox is enabled
        if (null !== $template && !$template instanceof self) {
            throw new \LogicException('A block must be a method on a \Twig\Template instance.');
        }
 
        if (null !== $template) {
            try {
                $template->$block($context, $blocks);
            } catch (Error $e) {
                if (!$e->getSourceContext()) {
                    $e->setSourceContext($template->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, $template->getSourceContext(), $e);
                $e->guess();
 
                throw $e;
            }
        } elseif (false !== $parent = $this->getParent($context)) {
            $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
    }
 
    protected function doDisplay(array $context, array $blocks = [])
    {
        // line 1
        $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "debugger", []), "startTimer", [0 => "render", 1 => "Rendering page"], "method");
        // line 2
        $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "theme", []), "setLayout", [], "method");
        // line 3
        $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "theme", []), "loadAtoms", [], "method");
        // line 4
        $context["segments"] = $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "theme", []), "segments", [], "method");
        // line 6
        ob_start(function () { return ''; });
        // line 7
        echo "    ";
        if ($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "theme", []), "hasContent", [], "method")) {
            // line 8
            echo "        ";
            $this->displayBlock('content', $context, $blocks);
            // line 10
            echo "    ";
        }
        $context["content"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
        // line 13
        $context["offcanvas"] = null;
        // line 14
        $context['_parent'] = $context;
        $context['_seq'] = twig_ensure_traversable(($context["segments"] ?? null));
        foreach ($context['_seq'] as $context["_key"] => $context["segment"]) {
            if (($this->getAttribute($context["segment"], "type", []) == "offcanvas")) {
                // line 15
                $context["offcanvas"] = $context["segment"];
            }
        }
        $_parent = $context['_parent'];
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['segment'], $context['_parent'], $context['loop']);
        $context = array_intersect_key($context, $_parent) + $_parent;
        // line 18
        ob_start(function () { return ''; });
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } 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;
        }
    }
 
    {
        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 (\Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
    public function __construct(Environment $env)
    {
        parent::__construct($env);
 
        $this->blocks = [
            'page_head' => [$this, 'block_page_head'],
            'page_footer' => [$this, 'block_page_footer'],
        ];
    }
 
    protected function doGetParent(array $context)
    {
        // line 1
        return "@nucleus/page.html.twig";
    }
 
    protected function doDisplay(array $context, array $blocks = [])
    {
        $this->parent = $this->loadTemplate("@nucleus/page.html.twig", "partials/page.html.twig", 1);
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }
 
    // line 3
    public function block_page_head($context, array $blocks = [])
    {
        // line 4
        if (($context["page_head"] ?? null)) {
            // line 5
            echo "        ";
            echo ($context["page_head"] ?? null);
            echo "
    ";
        } else {
            // line 7
            echo "        ";
            $this->displayParentBlock("page_head", $context, $blocks);
            echo "
    ";
        }
    }
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } 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;
        }
    }
 
    {
        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 (\Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
        $this->blocks = [
            'content' => [$this, 'block_content'],
        ];
    }
 
    protected function doGetParent(array $context)
    {
        // line 1
        return "partials/page.html.twig";
    }
 
    protected function doDisplay(array $context, array $blocks = [])
    {
        // line 2
        $context["twigTemplate"] = "page.html.twig";
        // line 3
        $context["scope"] = "page";
        // line 1
        $this->parent = $this->loadTemplate("partials/page.html.twig", "page.html.twig", 1);
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }
 
    // line 5
    public function block_content($context, array $blocks = [])
    {
        // line 6
        echo "
    <div class=\"platform-content\">
        <div class=\"content-wrapper\">
            <section class=\"entry\">
 
                ";
        // line 11
        $this->loadTemplate([0 => (("partials/content-" . ($context["scope"] ?? null)) . ".html.twig"), 1 => "partials/content.html.twig"], "page.html.twig", 11)->display($context);
        // line 12
        echo "
            </section>
        </div> <!-- /content-wrapper -->
    </div>
 
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } 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;
        }
    }
 
    {
        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 (\Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
    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 (\Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        } 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 {
     * @internal
     */
    public function __construct(Environment $env, Template $template)
    {
        $this->env = $env;
        $this->template = $template;
    }
 
    /**
     * Renders the template.
     *
     * @param array $context An array of parameters to pass to the template
     *
     * @return string The rendered template
     */
    public function render($context = [])
    {
        // 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_num_args() > 1 ? func_get_arg(1) : []);
    }
 
    /**
     * Displays the template.
     *
     * @param array $context An array of parameters to pass to the template
     */
    public function display($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_num_args() > 1 ? func_get_arg(1) : []);
    }
 
    /**
     * Checks if a block is defined.
     *
     * @param string $name    The block name
     * @param array  $context An array of parameters to pass to the template
     *
 
        $key = null;
        $output = false;
        if ( false !== $expires ) {
            ksort($data);
            $key = md5($file.json_encode($data));
            $output = $this->get_cache($key, self::CACHEGROUP, $cache_mode);
        }
 
        if ( false === $output || null === $output ) {
            $twig = $this->get_twig();
            if ( strlen($file) ) {
                $loader = $this->get_loader();
                $result = $loader->getCacheKey($file);
                do_action('timber_loader_render_file', $result);
            }
            $data = apply_filters('timber_loader_render_data', $data);
            $data = apply_filters('timber/loader/render_data', $data, $file);
            $template = $twig->load($file);
            $output = $template->render($data);
        }
 
        if ( false !== $output && false !== $expires && null !== $key ) {
            $this->delete_cache();
            $this->set_cache($key, $output, self::CACHEGROUP, $expires, $cache_mode);
        }
        $output = apply_filters('timber_output', $output);
        return apply_filters('timber/output', $output, $data, $file);
    }
 
    protected function delete_cache() {
        Cleaner::delete_transients();
    }
 
    /**
     * Get first existing template.
     *
     * @param array|string $templates  Name(s) of the Twig template(s) to choose from.
     * @return string|bool             Name of chosen template, otherwise false.
     */
        if ( $via_render ) {
            $file = apply_filters('timber_render_file', $file);
        } else {
            $file = apply_filters('timber_compile_file', $file);
        }
 
        $output = false;
 
        if ($file !== false) {
            if ( is_null($data) ) {
                $data = array();
            }
 
            if ( $via_render ) {
                $data = apply_filters('timber_render_data', $data);
            } else {
                $data = apply_filters('timber_compile_data', $data);
            }
 
            $output = $loader->render($file, $data, $expires, $cache_mode);
        } else {
            if ( is_array($filenames) ) {
                $filenames = implode(", ", $filenames);
            }
            Helper::error_log( 'Error loading your template files: '.$filenames.'. Make sure one of these files exists.' );
        }
 
        do_action('timber_compile_done');
        return $output;
    }
 
    /**
     * Compile a string.
     *
     * @api
     * @example
     * ```php
     * $data = array(
     *     'username' => 'Jane Doe',
     * );
        $twig = $dummy_loader->get_twig();
        $template = $twig->createTemplate($string);
        return $template->render($data);
    }
 
    /**
     * Fetch function.
     *
     * @api
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
     *                                 array, the first value is used for non-logged in visitors, the second for users.
     *                                 Default false.
     * @param string       $cache_mode Optional. Any of the cache mode constants defined in TimberLoader.
     * @return bool|string The returned output.
     */
    public static function fetch( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
        $output = self::compile($filenames, $data, $expires, $cache_mode, true);
        $output = apply_filters('timber_compile_result', $output);
        return $output;
    }
 
    /**
     * Render function.
     *
     * Passes data to a Twig file and echoes the output.
     *
     * @api
     * @example
     * ```php
     * $context = Timber::context();
     *
     * Timber::render( 'index.twig', $context );
     * ```
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
     * Passes data to a Twig file and echoes the output.
     *
     * @api
     * @example
     * ```php
     * $context = Timber::context();
     *
     * Timber::render( 'index.twig', $context );
     * ```
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
     *                                 array, the first value is used for non-logged in visitors, the second for users.
     *                                 Default false.
     * @param string       $cache_mode Optional. Any of the cache mode constants defined in TimberLoader.
     * @return bool|string The echoed output.
     */
    public static function render( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
        $output = self::fetch($filenames, $data, $expires, $cache_mode);
        echo $output;
        return $output;
    }
 
    /**
     * Render a string with Twig variables.
     *
     * @api
     * @example
     * ```php
     * $data = array(
     *     'username' => 'Jane Doe',
     * );
     *
     * Timber::render_string( 'Hi {{ username }}, I’m a string with a custom Twig variable', $data );
     * ```
     * @param string $string A string with Twig variables.
     * @param array  $data   An array of data to use in Twig template.
     * @return bool|string
     */
 *
 * To generate specific templates for your pages you can use:
 * /mytheme/views/page-mypage.html.twig
 * (which will still route through this PHP file)
 * OR
 * /mytheme/page-mypage.php
 * (in which case you'll want to duplicate this file and save to the above path)
 */
 
$gantry = Gantry\Framework\Gantry::instance();
$theme  = $gantry['theme'];
 
// We need to render contents of <head> before plugin content gets added.
$context              = Timber::get_context();
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
 
$post            = Timber::query_post();
$context['post'] = $post;
 
Timber::render(['page-' . $post->post_name . '.html.twig', 'page.html.twig'], $context);
 
            }
 
            break;
        }
    }
 
    if ( ! $template ) {
        $template = get_index_template();
    }
 
    /**
     * Filters the path of the current template before including it.
     *
     * @since 3.0.0
     *
     * @param string $template The path of the template to include.
     */
    $template = apply_filters( 'template_include', $template );
    if ( $template ) {
        include $template;
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
}
 
<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */
 
if ( ! isset( $wp_did_header ) ) {
 
    $wp_did_header = true;
 
    // Load the WordPress library.
    require_once __DIR__ . '/wp-load.php';
 
    // Set up the WordPress query.
    wp();
 
    // Load the theme template.
    require_once ABSPATH . WPINC . '/template-loader.php';
 
}
 
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
 
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );
 
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
 

Environment & details:

Key Value
format list
mcat 4,3,2
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE Apache
REQUEST_URI /summer-schedule/?format=list&mcat=4,3,2
TZ America/New_York
REDIRECT_REDIRECT_UNIQUE_ID YWqD54uHEQ9NmTMSN6N-mwAAAAM
REDIRECT_REDIRECT_HTTP_AUTHORIZATION
REDIRECT_REDIRECT_HTTPS on
REDIRECT_REDIRECT_SSL_TLS_SNI camphilltop.com
REDIRECT_REDIRECT_STATUS 200
REDIRECT_UNIQUE_ID YWqD54uHEQ9NmTMSN6N-mwAAAAM
REDIRECT_HTTP_AUTHORIZATION
REDIRECT_HTTPS on
REDIRECT_SSL_TLS_SNI camphilltop.com
REDIRECT_HANDLER application/x-httpd-ea-php73
REDIRECT_STATUS 200
UNIQUE_ID YWqD54uHEQ9NmTMSN6N-mwAAAAM
HTTPS on
SSL_TLS_SNI camphilltop.com
HTTP_USER_AGENT CCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.5
HTTP_IF_MODIFIED_SINCE Mon, 26 Jul 2021 15:28:55 GMT
HTTP_ACCEPT_ENCODING br,gzip
HTTP_HOST camphilltop.com
HTTP_CONNECTION Keep-Alive
PATH /usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
SERVER_SIGNATURE
SERVER_NAME camphilltop.com
SERVER_ADDR 216.117.140.178
SERVER_PORT 443
REMOTE_ADDR 35.173.35.159
DOCUMENT_ROOT /home/camphilltop/public_html
REQUEST_SCHEME https
CONTEXT_PREFIX /cgi-sys
CONTEXT_DOCUMENT_ROOT /usr/local/cpanel/cgi-sys/
SERVER_ADMIN webmaster@camphilltop.com
SCRIPT_FILENAME /home/camphilltop/public_html/index.php
REMOTE_PORT 48274
REDIRECT_URL /index.php
REDIRECT_QUERY_STRING format=list&mcat=4,3,2
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING format=list&mcat=4,3,2
SCRIPT_NAME /index.php
ORIG_SCRIPT_FILENAME /usr/local/cpanel/cgi-sys/ea-php73
ORIG_PATH_INFO /index.php
ORIG_PATH_TRANSLATED /home/camphilltop/public_html/index.php
ORIG_SCRIPT_NAME /cgi-sys/ea-php73
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1634370535.101
REQUEST_TIME 1634370535
argv Array ( [0] => format=list&mcat=4,3,2 )
argc 1
empty
0. Whoops\Handler\PrettyPageHandler