Evolution cms parse error

Ожидают ответа 1 человек. Станьте первым, кто даст ответ! Или подпишитесь на вопрос, чтобы узнать ответ, когда он появится.

На странице где добавить в сравнение можно, вот такая ошибка

GET //evo/compare_parent?data%5B0%5D%5B%5D=6&data%5B1%5D%5B%5D=5&data %5B2%5D%5B%5D=4&data%5B3%5D%5B%5D=3500 (Internal Server Error)

При добавлении, добавляет и удаляет, но почему-то не хранит в куках, после обновлении страницы нет данных.
609550277372d833362356.png

в логах пишет вот такое

« Evolution CMS Parse Error »
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AND (c.parent IN (‘0′,’2′,’7’) OR c.id IN(‘0′,’2′,’7′)) AND c.deleted=0 AND c.pu’ at line 1

Лог

EvolutionCMSCore->processRoutes()
index.php on line 137
IlluminatePipelinePipeline->then(Closure $var1)
core/src/Core.php on line 2692
IlluminatePipelinePipeline->IlluminatePipeline{closure}(IlluminateHttpRequest $var1)
core/vendor/illuminate/pipeline/Pipeline.php on line 103
EvolutionCMSCore->EvolutionCMS{closure}(IlluminateHttpRequest $var1)
core/vendor/illuminate/pipeline/Pipeline.php on line 128
IlluminateRoutingRouter->dispatch(IlluminateHttpRequest $var1)
core/src/Core.php on line 2691
IlluminateRoutingRouter->dispatchToRoute(IlluminateHttpRequest $var1)
core/vendor/illuminate/routing/Router.php on line 625
IlluminateRoutingRouter->runRoute(IlluminateHttpRequest $var1, IlluminateRoutingRoute $var2)
core/vendor/illuminate/routing/Router.php on line 636
IlluminateRoutingRouter->runRouteWithinStack(IlluminateRoutingRoute $var1, IlluminateHttpRequest $var2)
core/vendor/illuminate/routing/Router.php on line 670
IlluminatePipelinePipeline->then(Closure $var1)
core/vendor/illuminate/routing/Router.php on line 695
IlluminatePipelinePipeline->IlluminatePipeline{closure}(IlluminateHttpRequest $var1)
core/vendor/illuminate/pipeline/Pipeline.php on line 103
IlluminateRoutingRouter->IlluminateRouting{closure}(IlluminateHttpRequest $var1)
core/vendor/illuminate/pipeline/Pipeline.php on line 128
IlluminateRoutingRoute->run()
core/vendor/illuminate/routing/Router.php on line 693
IlluminateRoutingRoute->runCallable()
core/vendor/illuminate/routing/Route.php on line 200
EvolutionCMSExtensionsRouter->EvolutionCMSExtensions{closure}(‘compare_parent’)
core/vendor/illuminate/routing/Route.php on line 230
EvolutionCMSCore->executeParser()
core/src/Extensions/Router.php on line 25
EvolutionCMSCore->sendErrorPage()
core/src/Core.php on line 2783
EvolutionCMSCore->invokeEvent(‘OnPageNotFound’)
core/src/Core.php on line 505
EvolutionCMSCore->evalPlugin(string $var1, array $var2)
core/src/Core.php on line 5642
eval()
core/src/Core.php on line 1854
require(string $var1)
core/src/Core.php(1854) : eval()’d code on line 14
EvolutionCMSCore->runSnippet(‘DocLister’, array $var2)
assets/snippets/compare/plugin.compare.php on line 87
EvolutionCMSCore->evalSnippet(string $var1, array $var2)
core/src/Core.php on line 4418
eval()
core/src/Core.php on line 1918
require(string $var1)
core/src/Core.php(1918) : eval()’d code on line 1
site_contentDocLister->getDocs()
assets/snippets/DocLister/snippet.DocLister.php on line 42
site_contentDocLister->getChildrenList()
assets/snippets/DocLister/core/controller/site_content.php on line 87
DocLister->dbQuery(string $var1)
assets/snippets/DocLister/core/controller/site_content.php on line 573
EvolutionCMSDatabase->query(string $var1)
assets/snippets/DocLister/core/DocLister.abstract.php on line 1772

Open

Bug with getDocumentChildren() and getAllChildren() in version 3.1.10 #2089

Issue Opened

Q2apro Opened Issue On Apr 28th 2022, 1:28

Q2apro

When I use this query:

$children = $modx->getDocumentChildren($docid, 1, 0, 'id, pagetitle, description, alias, parent', '', 'pagetitle', 'ASC');

I get the error:

« Evolution CMS Parse Error »
SQLSTATE[42S22]: Column not found: 1054 Unknown column ' pagetitle' in 'field list' (SQL: select `id`, ` pagetitle`, ` description`, ` alias`, ` parent` from `modx_site_content` where `modx_site_content`.`parent` = 11 and `modx_site_content`.`published` = 1 and `modx_site_content`.`deleted` = 0 and `privatemgr` = 0 and `modx_site_content`.`deletedon` = 0 order by `pagetitle` asc)

File /core/vendor/illuminate/database/Connection.php
Line 712 

But the column pagetitle is in the database!

It seems that there is a whitespace before the ‘_pagetitle’.

What I did before: I copied one EvoCMS instance to a new server. The old server processes the query fine, the new server crashes with the error message.

Same error with:

$childrendocs = $modx->getDocumentChildren($parentid, 1, 0, 'id, pagetitle, description, alias, parent, content', '', 'alias + 0', 'ASC');

« Evolution CMS Parse Error »
SQLSTATE[42S22]: Column not found: 1054 Unknown column ' pagetitle' in 'field list' (SQL: select `id`, ` pagetitle`, ` description`, ` alias`, ` parent`, ` content` from `modx_site_content` where `modx_site_content`.`parent` = 71 and `modx_site_content`.`published` = 1 and `modx_site_content`.`deleted` = 0 and `privatemgr` = 0 and `modx_site_content`.`deletedon` = 0 order by `alias + 0` asc) 

I also updated to EVO CMS 3.1.10. Could this be the problem?

Comment

Q2apro commented on 9 months ago

Q2apro

The Backtrace:

Backtrace
--
EvolutionCMSCore->processRoutes()index.php on line 137
IlluminateRoutingRouter->dispatch()core/src/Core.php on line 2701
IlluminateRoutingRouter->dispatchToRoute()core/vendor/illuminate/routing/Router.php on line 651
IlluminateRoutingRouter->runRoute()core/vendor/illuminate/routing/Router.php on line 662
IlluminateRoutingRouter->runRouteWithinStack()core/vendor/illuminate/routing/Router.php on line 698
IlluminatePipelinePipeline->then()core/vendor/illuminate/routing/Router.php on line 723
IlluminatePipelinePipeline->IlluminatePipeline{closure}()core/vendor/illuminate/pipeline/Pipeline.php on line 103
IlluminateRoutingRouter->IlluminateRouting{closure}()core/vendor/illuminate/pipeline/Pipeline.php on line 128
IlluminateRoutingRoute->run()core/vendor/illuminate/routing/Router.php on line 721
IlluminateRoutingRoute->runCallable()core/vendor/illuminate/routing/Route.php on line 208
EvolutionCMSExtensionsRouter->EvolutionCMSExtensions{closure}()core/vendor/illuminate/routing/Route.php on line 238
EvolutionCMSCore->executeParser()core/src/Extensions/Router.php on line 25
EvolutionCMSCore->prepareResponse()core/src/Core.php on line 2820
EvolutionCMSCore->outputContent()core/src/Core.php on line 2979
EvolutionCMSCore->parseDocumentSource()core/src/Core.php on line 784
EvolutionCMSCore->evalSnippets()core/src/Core.php on line 2650
EvolutionCMSCore->_get_snip_result()core/src/Core.php on line 1993
EvolutionCMSCore->evalSnippet()core/src/Core.php on line 2082
eval()core/src/Core.php on line 1918
EvolutionCMSCore->getDocumentChildren()core/src/Core.php(1918) : eval()'d code on line 111
IlluminateDatabaseEloquentBuilder->get()core/src/Core.php on line 3955
IlluminateDatabaseEloquentBuilder->getModels()core/vendor/illuminate/database/Eloquent/Builder.php on line 609
IlluminateDatabaseQueryBuilder->get()core/vendor/illuminate/database/Eloquent/Builder.php on line 625
IlluminateDatabaseQueryBuilder->onceWithColumns()core/vendor/illuminate/database/Query/Builder.php on line 2374
IlluminateDatabaseQueryBuilder->IlluminateDatabaseQuery{closure}()core/vendor/illuminate/database/Query/Builder.php on line 2907
IlluminateDatabaseQueryBuilder->runSelect()core/vendor/illuminate/database/Query/Builder.php on line 2373
IlluminateDatabaseConnection->select()core/vendor/illuminate/database/Query/Builder.php on line 2385
IlluminateDatabaseConnection->run()core/vendor/illuminate/database/Connection.php on line 376
IlluminateDatabaseConnection->runQueryCallback()core/vendor/illuminate/database/Connection.php on line 672 

Comment

Q2apro commented on 9 months ago

Q2apro

Replacing the function getDocumentChildren() with the version from v2.0.4 removes the bug!

Function can can be found in file /core/src/Core.php

The previous function works without problems:

 public function getDocumentChildren(
        $parentid = 0,
        $published = 1,
        $deleted = 0,
        $fields = '*',
        $where = '',
        $sort = 'menuindex',
        $dir = 'ASC',
        $limit = ''
    ) {

        $cacheKey = md5(print_r(func_get_args(), true));
        if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
            return $this->tmpCache[__FUNCTION__][$cacheKey];
        }

        if ($published === 'all') {
            $published = '';
        } else {
            $published = 'AND sc.published = ' . $published;
        }
        if ($deleted === 'all') {
            $deleted = '';
        } else {
            $deleted = 'AND sc.deleted = ' . $deleted;
        }

        if ($where != '') {
            $where = 'AND ' . $where;
        }

        // modify field names to use sc. table reference
        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
        if ($sort == '') {
            $sort = '';
        } else {
            $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
        }

        // get document groups for current user
        if ($docgrp = $this->getUserDocGroups()) {
            $docgrp = implode(',', $docgrp);
        }

        // build query
        if ($this->isFrontend()) {
            if (!$docgrp) {
                $access = ('sc.privateweb=0');
            } else {
                $access = sprintf('sc.privateweb=0 OR dg.document_group IN (%s)', $docgrp);
            }
        } else {
            $access = ('1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
        }

        $tblsc = $this->getDatabase()->getFullTableName('site_content');
        $tbldg = $this->getDatabase()->getFullTableName('document_groups');

        $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc
                LEFT JOIN {$tbldg} dg on dg.document = sc.id",
            "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id",
            ($sort ? "{$sort} {$dir}" : ""), $limit);

        $resourceArray = $this->getDatabase()->makeArray($result);

        $this->tmpCache[__FUNCTION__][$cacheKey] = $resourceArray;

        return $resourceArray;
    } 

The new function from 3.1.10 does not work.

Comment

Q2apro commented on 9 months ago

Q2apro

The same problem and fix with getAllChildren().

Version from EVO2:

 public function getAllChildren($id = 0, $sort = 'menuindex', $dir = 'ASC', $fields = 'id, pagetitle, description, parent, alias, menutitle') {
        static $cached = array();
        $cacheKey = md5(print_r(func_get_args(), true));
        if (isset($cached[$cacheKey])) {
            return $cached[$cacheKey];
        }

        $cached[$cacheKey] = false;

        // modify field names to use sc. table reference
        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
        // get document groups for current user
        if ($docgrp = $this->getUserDocGroups()) {
            $docgrp = implode(',', $docgrp);
        }
        // build query
        if ($this->isFrontend()) {
            if (!$docgrp) {
                $access = 'sc.privateweb=0';
            } else {
                $access = sprintf('sc.privateweb=0 OR dg.document_group IN (%s)', $docgrp);
            }
        } else {
            if (!$docgrp) {
                $access = sprintf(
                    "1='%s' OR sc.privatemgr=0"
                    , $_SESSION['mgrRole']
                );
            } else {
                $access = sprintf(
                    "1='%s' OR sc.privatemgr=0 OR dg.document_group IN (%s)"
                    , $_SESSION['mgrRole']
                    , $docgrp
                );
            }
        }
        $result = $this->getDatabase()->select(
            'DISTINCT ' . $fields
            , sprintf(
                '%s sc
                LEFT JOIN %s dg on dg.document = sc.id'
                , $this->getDatabase()->getFullTableName('site_content')
                , $this->getDatabase()->getFullTableName('document_groups')
            )
            , sprintf(
                "sc.parent=%d AND (%s) GROUP BY sc.id"
                , (int)$id
                , $access
            )
            , $sort . ' ' . $dir
        );
        $resourceArray = $this->getDatabase()->makeArray($result);
        $cached[$cacheKey] = $resourceArray;

        return $resourceArray;
    } 

The previous version works.

Comment

Q2apro commented on 8 months ago

Q2apro

Will there be a fix?

So that those normal queries will work with EVO CMS 3.10+ again?

$children = $modx->getDocumentChildren($docid, 1, 0, 'id, pagetitle, description, alias, parent', '', 'pagetitle', 'ASC');

Pathologic

@q2apro try https://github.com/evocms-community/evolution

Comment

Q2apro commented on 7 months ago

Q2apro

I used the updater and got version 3.1.10.

How to tell the updater it should use the community edition?

When will it be fixed? With 3.1.11?

Pathologic

https://forum.evo.im/d/234-v3111-ce-release/2

Or change the Version parameter of the Updater plugin to evocms-community/evolution, clear the site cache (Tools — Clear Cache) and update notification will appear at the dashboard.

22 июня 2022 г. 08:09:26 GMT+03:00, q2apro @.***> пишет:

I used the updater and got version 3.1.10.

How to tell the updater it should use the community edition?

When will it be fixed? With 3.1.11?


Reply to this email directly or view it on GitHub:
https://github.com/evolution-cms/evolution/issues/2089#issuecomment-1162648105
You are receiving this because you commented.

Message ID: @.***>

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Event id 1006 error code 82
  • Europa universalis 4 ошибка связи со steam
  • Euro truck simulator 2 как изменить мощность двигателя
  • Euro truck simulator 2 как изменить деньги
  • Euro truck simulator 2 как изменить время

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии