Core xpdo om xpdoobject class php 240 error 42000 executing statement

Как найти ошибку sql из лога MODX? [2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement: Array ( [0] => 42000 [1] => 1064 [2] => 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 ‘) […]

Содержание

  1. Как найти ошибку sql из лога MODX?
  2. Как найти ошибку sql из лога MODX?
  3. Delete user error (Could not get table class or name for class: modAccess) #11276
  4. Comments
  5. Widget Who’s Online cause error «sql_mode=only_full_group_by» #13730
  6. Comments
  7. Summary
  8. Step to reproduce
  9. Observed behavior
  10. Expected behavior
  11. Environment
  12. Белый экран в админке
  13. Комментарии (5)
  14. ТОП 10 сайтов в году

Как найти ошибку sql из лога MODX?

[2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘) DESC’ at line 1
)

upd. Кто столкнется с такой ситуацией, можно исправить эту строку в xpdoobject.class.php и добавить вывод полного sql запроса.

$xpdo->log(xPDO::LOG_LEVEL_ERROR, ‘Error ‘ . $criteria->stmt->errorCode() . » executing statement: n» . print_r($errorInfo, true) . ‘SQL’ . $criteria->toSQL());

  • Вопрос задан более трёх лет назад
  • 340 просмотров

Откройте файл /home/site.ru/core/xpdo/om/xpdoobject.class.php строка 240
и посмотрите что там за запрос такой, который ошибку выдает.
хотя это наврено PDO шный класс? хм. ну хотя бы посмотреть какой там объект/метод вызывается
и в коде искать вызов этого места.

PS: скопируйте с продакшена базу! тогда возможно скорее всего и получится повторить.

if (!$criteria->stmt->execute()) <
$xpdo->queryTime += microtime(true) — $tstart;
$xpdo->executedQueries++;
$xpdo->log(xPDO::LOG_LEVEL_ERROR, «Error » . $criteria->stmt->errorCode() . » executing statement: n» . print_r($criteria->stmt->errorInfo(), true));
>

Источник

Как найти ошибку sql из лога MODX?

[2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘) DESC’ at line 1
)

upd. Кто столкнется с такой ситуацией, можно исправить эту строку в xpdoobject.class.php и добавить вывод полного sql запроса.

$xpdo->log(xPDO::LOG_LEVEL_ERROR, ‘Error ‘ . $criteria->stmt->errorCode() . » executing statement: n» . print_r($errorInfo, true) . ‘SQL’ . $criteria->toSQL());

  • Вопрос задан более трёх лет назад
  • 340 просмотров

Откройте файл /home/site.ru/core/xpdo/om/xpdoobject.class.php строка 240
и посмотрите что там за запрос такой, который ошибку выдает.
хотя это наврено PDO шный класс? хм. ну хотя бы посмотреть какой там объект/метод вызывается
и в коде искать вызов этого места.

PS: скопируйте с продакшена базу! тогда возможно скорее всего и получится повторить.

if (!$criteria->stmt->execute()) <
$xpdo->queryTime += microtime(true) — $tstart;
$xpdo->executedQueries++;
$xpdo->log(xPDO::LOG_LEVEL_ERROR, «Error » . $criteria->stmt->errorCode() . » executing statement: n» . print_r($criteria->stmt->errorInfo(), true));
>

Источник

Delete user error (Could not get table class or name for class: modAccess) #11276

When deleting multiple Users at a time (via the User grid, and performing Bulk Actions > Delete Selected), the users appear to be deleted as expected, but the following errors are logged.

Seems like a missing table (or invalid table reference)?

NOTE: This was tested using [2.3].

The text was updated successfully, but these errors were encountered:

Seems to happen when deleting even a single user, not specific to Bulk Actions > Delete.

This is the result of an abstract relation to modAccess, which all modAccess* classes extend. This has been a problem since the beginning and likely needs some attention deep inside xPDO. It is harmless, but annoying.

Good to know, thanks Jason. Worth leaving this issue open?

Yes, lest we forget about it.

@opengeek may be just remove extending between modPrincipal and modUser? Since User is not a Principal itself but only through modUserGroup.

modUser is a principal, it’s just not implemented in the ACL tables yet, so that is not a valid solution.

There’s still problem with removing users (i’m using extUser class instead of normal modUser). Just a small reminder 🙂

Still an issue in 2.4.0-pl

Getting these in 2.4.2 when doing just about anything with users.

Also got this error when deleting one user (MODX 2.5.0):

[2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/xpdo.class.php : 1318) Could not get table class for class: modAccess
[2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/xpdo.class.php : 1287) Could not get table name for class: modAccess
[2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘AS modAccess WHERE modAccess . principal = 35’ at line 1
)

Ah, I’ve just come across this when creating a user-centric extra. (MODX 2.5.6)
The error does not occur when using the core user management panel however.
Is it known what exactly is setting it off?

Still an issue in 2.6.0-pl

Just bit me in 2.7.2.

This is a workaround:

[Update] This does not work reliably.

This is a workaround:

@opengeek Is this a solution?

Sorry, I thought that was a solution, but it doesn’t actually work.

This issue has been mentioned on MODX Community. There might be relevant details there:

Источник

Summary

Widget: «Who’s Online» cause an error «sql_mode=only_full_group_by» since mySQL 5.7+

Step to reproduce

  • several test with new installed MODX 2.6.1
  • no error if I deactivate the Widget Who’s Online (widget.grid-online.php)

Observed behavior

Each time I click on the dashboard, the error log is generated this error:

Expected behavior

Environment

  • MODX 2.6.1
  • Linux Ubuntu 16.04
  • php 7.0.22
  • mySQL 5.7.20

The text was updated successfully, but these errors were encountered:

Could you try to change this line

No, I get exactly the same error. However this is working:
$query->groupby(‘id’);

Thanks for the hint! Maybe you have an idea why it with ‘user’ doesn’t working.
I guess to group the result with the ‘id’ is also good?

I guess to group the result with the ‘id’ is also good?

No, then you have double entries for the same user, since you are grouping by modManagerLog.id and if one user has done more than one logged actions in the manager …

But since the error is a bit different than expected: Change the lines

Lines 24 to 25 in 689ca8b

$ query -> groupby ( ‘user’ );
$ query -> select ( $ this -> modx -> getSelectColumns ( ‘modManagerLog’ , ‘modManagerLog’ ));

Hi Jako, thanks for your support. I tried it, but also brings the same mistake.

my print screen Who’s Online when I ‘grouping by id’

Sorry, I can’t understand. I have no double entries. For my understanding is a grouping by UserID or Username the same. Sorry, maybe I don’t understand that correctly and on the wrong track?

Update: I got it! The list should not show all my recent activities. ‘Who’s Online’ means ‘Who’s Online’
was probably a long night 😉

Is the error away with the patch in #13730 (comment)?

Unfortunately not, when I exclude the groupby I get no error but the Who’s Online table shows all entries like the print screen before (as you already mentioned):

If I understand MySQL 5.7 Handling of GROUP BY correctly is the fault that the nonaggregated id column in the select list is not named in the GROUP BY clause.

I get no error if I try:
$query->groupby(‘modManagerLog.user, modManagerLog.id’);
That’s not the solution, because the result is the same as exclude that line.

Maybe it is possible to use groupby with MAX(‘occurred’) for each user?

Источник

Белый экран в админке

Доброго времени суток.
Во время работы просто перестала загружаться админка сайта.
Искал подобные вопросы, но решения написанные там не помогли, путь /manager/?a=system/settings так же выдаёт белый экран.

Что делать и как быть?

Комментарии (5)

[2019-02-12 22:20:40] (ERROR @ C:UsersDenisDesktopOpenServerOSPaneldomainsmodxloccorexpdoomxpdoobject.class.php: 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘ASC, category ASC’ at line 1
)

[2019-02-12 22:24:24] (ERROR @ C:UsersDenisDesktopOpenServerOSPaneldomainsmodxloccorexpdoomxpdoobject.class.php: 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘ASC’ at line 1
)

помнится было такое

один раз нужно было отключить Отображение RSS-канала

другой раз из за новой версии FORMIT

для него php нужно версии > 5.6

Не знаю каким образом но после десятого перезапуска всё заработало.

Но на всякий случай оставлю это тут modx.pro/help/13665

Для добавления комментариев вы должны авторизоваться или зарегистрироваться.

ТОП 10 сайтов в году

К сожалению, пока недостаточно данных. Пожалуйста, выберите другой год.

Источник

Постоянно выходит ошибка про синтаксис SQL. Не могу понять где ее искать. Подскажете как ее поймать?
Пробовал искать переходя по ссылкам на сайте и делая действия в админке. Так и не нашел. Ошибка появляется на продакшене, а на копии не получается повторить.

[2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘) DESC’ at line 1
)

upd. Кто столкнется с такой ситуацией, можно исправить эту строку в xpdoobject.class.php и добавить вывод полного sql запроса.

$xpdo->log(xPDO::LOG_LEVEL_ERROR, ‘Error ‘ . $criteria->stmt->errorCode() . » executing statement: n» . print_r($errorInfo, true) . ‘SQL’ . $criteria->toSQL());


  • Вопрос задан

    более трёх лет назад

  • 351 просмотр

Откройте файл /home/site.ru/core/xpdo/om/xpdoobject.class.php строка 240
и посмотрите что там за запрос такой, который ошибку выдает.
хотя это наврено PDO шный класс? хм… ну хотя бы посмотреть какой там объект/метод вызывается
и в коде искать вызов этого места.

PS: скопируйте с продакшена базу! тогда возможно скорее всего и получится повторить.

Пригласить эксперта


  • Показать ещё
    Загружается…

09 февр. 2023, в 12:14

1 руб./за проект

09 февр. 2023, в 11:42

7000 руб./за проект

09 февр. 2023, в 11:23

1500 руб./за проект

Минуточку внимания

When deleting multiple Users at a time (via the User grid, and performing Bulk Actions > Delete Selected), the users appear to be deleted as expected, but the following errors are logged.

Seems like a missing table (or invalid table reference)?

NOTE: This was tested using [2.3].

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => 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 'AS `modAccess` WHERE `modAccess`.`principal` = 3' at line 1
)

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => 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 'AS `modAccess` WHERE `modAccess`.`principal` = 4' at line 1
)

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => 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 'AS `modAccess` WHERE `modAccess`.`principal` = 5' at line 1
)

Constantly comes an error about SQL syntax. I can not understand where to look. Tell me how to catch it?
Tried to search through links on the website and doing the actions in the admin area. Never found. Error in production, but in the copy it is impossible to repeat.

[2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => 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 ‘) DESC’ at line 1
)

upd. Who encounter such a situation, you can correct this string in xpdoobject.class.php and add the output of the full sql of the query.

$xpdo->log(xPDO::LOG_LEVEL_ERROR, ‘Error’ . $criteria->stmt->errorCode() . «executing statement: n» . print_r($errorInfo, true) . ‘SQL’ . $criteria->toSQL());

2 answers

Open the file /home/site.ru/core/xpdo/om/xpdoobject.class.php line 240
and see that there is a query that gives an error.
although this is navreno shny PDO class? hmm… well at least to see what object/method is called
and in the code look for calling this place.

PS: copy from production database! then maybe most likely will have to repeat.

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 ‘) DESC’ at line 1

it is.

Find more questions by tags MODXSQL

Подтверждать. Если я удаляю пользователя, я получаю сообщение об ошибке в файле журнала.

Также на 3.0 на Localhost, PHP 7.1.8

Можете ли вы выяснить, какой процессор вызывает эту проблему?

Я также был бы признателен за более конкретные шаги по воспроизведению этого. «Такая же ошибка появлялась при добавлении пользователя и назначении группы пользователей». слишком неспецифичен для меня.

Также подтверждено.

Действия по воспроизведению:

  1. Создайте нового пользователя с именем пользователя, полным именем и адресом электронной почты (оставьте все остальные настройки пользователя)
  2. Нажмите «Сохранить»
  3. После сохранения пользователя удалите его из представления сетки здесь /manager/a=security/user
  4. Просмотреть журнал ошибок

«Такая же ошибка появлялась при добавлении пользователя и назначении группы пользователей». слишком неспецифичен для меня.

Когда во фрагменте регистра (который поставляется с дополнительным параметром входа) задано & usergroups и пользователь регистрируется, он генерирует ошибку в журнале ошибок, как указано здесь. https://github.com/modxcms/Login/issues/117

Спасибо :) Если у меня будет время, посмотрю, смогу ли я подготовить для этого пулреквест. Я думаю, это относительно легко исправить.

Привет! Насколько я понимаю, проблема в составной, потому что Xpdo делает такой SQL
ВЫБЕРИТЕ modAccess . id AS modAccess_id ,
modAccess . target AS modAccess_target ,
modAccess . principal_class AS modAccess_principal_class , modAccess . principal AS modAccess_principal , modAccess . authority AS modAccess_authority , modAccess . policy AS modAccess_policy
ОТ КАК modAccess ГДЕ modAccess . principal = 2

Пытаюсь поменять строчки в файлах
core model schema modx.mysql.schema.xml, строка 849

     <composite alias="Acls" class="modAccess" local="id" foreign="principal" cardinality="many" owner="local" />

к

     <composite alias="Acls" class="modAccessAction" local="id" foreign="principal" cardinality="many" owner="local" />

И файл core model modx sqlsrv modprincipal.map.inc.php строка 20
'class' => 'modAccess',
к
‘class’ => ‘ modAccessAction ‘,

_Я прав?_

Возможно, вы обнаружили что-то @ воск100 — поскольку это составной файл, xPDO попытается удалить связанные записи. Я не думаю, что ваше исправление правильное, поскольку существуют различные типы доступа, которые все расширяют modAccess, и мы не просто пытаемся удалить modAccessAction.

Я не сразу уверен, что было бы лучше исправить, это могло бы просто удалить это отношение (= потенциальное критическое изменение) или, по крайней мере, изменить его на агрегат вместо составного, чтобы xPDO не пытался удалить то, что не делает. они существуют именно таким образом.

Привет, такая же проблема и подтверждено:

MODX Revolution 2.7.1-pl
PHP 7.2.17
MySQL 5.7.26

MODX Revolution и MySQL v5.7.x: проблема с сохранением значений TV-параметров

Работая с новым сайтом на движке MODX Revolution я столкнулся с проблемой невозможности сохранения значений пользовательских TV-параметров. Как оказалось, всему виной была новая версия MySQL.

Суть проблемы

Во время сохранения ресурса значения TV-параметров не сохраняются в таблице базы данных (modx_site_tmplvar_contentvalues), при этом внешне всё выглядит нормально: после сохранения в соответствующих полях отображаются обновлённые значения. Однако после перезагрузки страницы редактирования поля вновь оказываются пустыми (или заполненными значениями по умолчанию).

В файле error.log системы (раздел Управление→Отчёты→Журнал ошибок административной панели) отображается следующее сообщение об ошибке:

[2016-10-19 08:18:19] (ERROR @ /var/www/init/www/core/xpdo/om/xpdoobject.class.php : 240) Error HY000 executing statement: 
Array
(
    [0] => HY000
    [1] => 3065
    [2] => Expression #1 of ORDER BY clause is not in SELECT list, references column 'init.tvtpl.rank' which is not in SELECT list; this is incompatible with DISTINCT
)

Версия MODX Revolution: 2.5.0-pl

Версия MySQL: 5.7.15

Причина

Потратив приличное количество времени на поиск решения в интернете, я узнал, что всё дело в новой версии MySQL и её обновлённых настройках по умолчанию: задействована настройка ONLY_FULL_GROUP_BY, в результате чего перестаёт работать часть запросов MODX. Как оказалось, проблема уже известна разработчикам (описание в багтрекере MODX на GitHub: https://github.com/modxcms/revolution/issues/12826) и будет исправлена в новых версиях движка (скорее всего в версии 2.5.2-pl).

Решение

Чтобы не ждать официального релиза с исправлениями и обновлять движок, вы можете самостоятельно внести правки в файлы ядра MODX, к счастью исправлять придётся немного:

  • Файл /core/model/modx/modresource.class.php:
    		$c = $resource->xpdo->newQuery('modTemplateVar');
    		$c->query['distinct'] = 'DISTINCT';
    		$c->select($resource->xpdo->getSelectColumns('modTemplateVar', 'modTemplateVar'));
    		$c->select($resource->xpdo->getSelectColumns('modTemplateVarTemplate', 'tvtpl', '', array('rank')));
    		if ($resource->isNew()) {
    			$c->select(array(
    					'modTemplateVar.default_text AS value',

    Добавлена строка №342.

  • Файл /core/model/modx/modtemplate.class.php:
    			$c = $this->xpdo->newQuery('modTemplateVar');
    			$c->query['distinct'] = 'DISTINCT';
    			$c->select($this->xpdo->getSelectColumns('modTemplateVar'));
    			$c->select($this->xpdo->getSelectColumns('modTemplateVarTemplate', 'tvtpl', '', array('rank')));
    			$c->select(array('value' => $this->xpdo->getSelectColumns('modTemplateVar', 'modTemplateVar', '', array('default_text'))));
    			$c->innerJoin('modTemplateVarTemplate','tvtpl',array(
    				'tvtpl.tmplvarid = modTemplateVar.id',

    Добавлена строка №144.

После внесения изменений механизм сохранения значений TV-параметров должен работать нормально.

Скажу ещё, что можно просто отказаться от использования MySQL последней версии, однако не думаю, что такой способ решения проблемы придётся вам по душе.

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

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

  • Continuum shaders error
  • Continuity count error что это
  • Continue for syntax error vba
  • Core ndss http error 401 authentication failed
  • Core media error domain вк что значит

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

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