|
CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near
'LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM lime_tokens_928514 t WHERE tid= LIMIT 1
/var/www/limesurvey/vendor/yiisoft/yii/framework/db/CDbCommand.php(543)
531 {
532 if($this->_connection->enableProfiling)
533 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534
535 $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536 $message=$e->getMessage();
537 Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'sys
539
540 if(YII_DEBUG)
541 $message.='. The SQL statement executed was: '.$this->getText().$par;
542
543 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545 }
546 }
547
548 /*
549 Builds a SQL SELECT statement from the given query specification.
550 @param array $query the query specification in name-value pairs. The following
551 query options are supported: {@link select}, {@link distinct}, {@link from},
552 {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553 {@link limit}, {@link offset} and {@link union}.
554 @throws CDbException if "from" key is not present in given query parameter
555 @return string the SQL statement
Stack Trace
#0 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/CDbCommand.php(415): CDbCommand->queryInternal()
#1 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(1359): CDbCommand->queryRow()
#2
– /var/www/limesurvey/application/models/LSActiveRecord.php(77): CActiveRecord->query()
72 @since 1.1.7
73 /
74 protected function query($criteria, $all = false, $asAR = true)
75 {
76 if ($asAR === true) {
77 return parent::query($criteria, $all);
78 } else {
79 $this->beforeFind();
80 $this->applyScopes($criteria);
81 if (!$all) {
82 $criteria->limit = 1;
#3 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(1464): LSActiveRecord->query()11/9/23, 9:14 AM CDbException
https://lime-dev.haifa.ac.il/index.php/344959 2/2
#4
– /var/www/limesurvey/application/core/plugins/AuditLog/AuditLog.php(390): CActiveRecord->find()
385 $sTokenIds = $this->getEvent()->get('sTokenIds');
386 $aTokenIds = explode(',', $sTokenIds);
387 $oCurrentUser = $this->api->getCurrentUser();
388
389 foreach ($aTokenIds as $tokenId) {
390 $token = Token::model($iSurveyID)->find('tid=' . $tokenId);
391
392 if (!is_null($token)) {
393 $aValues = $token->getAttributes();
394 $oAutoLog = $this->api->newModel($this, 'log');
395 $oAutoLog->uid = $oCurrentUser->uid;
#5 unknown(0): AuditLog->beforeTokenDelete()
#6
– /var/www/limesurvey/application/libraries/PluginManager/PluginManager.php(269): call_user_func()
264 if (
265 !$event->isStopped()
266 && (empty($target) || in_array(get_class($subscription[0]), $target))
267 ) {
268 $subscription[0]->setEvent($event);
269 call_user_func($subscription);
270 }
271 }
272 }
273
274 return $event;
#7 + /var/www/limesurvey/application/models/behaviors/PluginEventBehavior.php(99): LimeSurvey\PluginManager\PluginManager-
dispatchEvent()
#8
- /var/www/limesurvey/application/models/behaviors/PluginEventBehavior.php(73): PluginEventBehavior->dispatchPluginModelEvent()
#9 + /var/www/limesurvey/application/models/behaviors/PluginEventBehavior.php(43): PluginEventBehavior->dispatchDynamic()
#10 + /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CComponent.php(561): PluginEventBehavior->beforeDelete()
#11 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(865): CComponent->raiseEvent()
#12 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(979): CActiveRecord->onBeforeDelete()
#13
- /var/www/limesurvey/application/models/Token.php(118): CActiveRecord->beforeDelete()
#14 + /var/www/limesurvey/vendor/yiisoft/yii/framework/db/ar/CActiveRecord.php(1228): Token->beforeDelete()
#15 + /var/www/limesurvey/upload/plugins/Feedback360Nomination/Feedback360Nomination.php(611): CActiveRecord->delete()
#16 + /var/www/limesurvey/upload/plugins/Feedback360Nomination/Feedback360Nomination.php(337): Feedback360Nomination-
deleteOtherTokens()
#17 unknown(0): Feedback360Nomination->Invite()
#18 + /var/www/limesurvey/application/libraries/PluginManager/PluginManager.php(269): call_user_func()
#19 + /var/www/limesurvey/application/helpers/SurveyRuntimeHelper.php(1309): LimeSurvey\PluginManager\PluginManager->dispatchEvent()
#20 + /var/www/limesurvey/application/helpers/SurveyRuntimeHelper.php(217): SurveyRuntimeHelper->moveSubmitIfNeeded()
#21 + /var/www/limesurvey/application/controllers/survey/index.php(636): SurveyRuntimeHelper->run()
#22
- /var/www/limesurvey/application/controllers/survey/index.php(22): Index->action()
#23 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/actions/CAction.php(76): Index->run()
#24 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(308): CAction->runWithParams()
#25 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(286): CController->runAction()
#26 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CController.php(265): CController->runActionWithFilters()
#27 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CWebApplication.php(282): CController->run()
#28 + /var/www/limesurvey/vendor/yiisoft/yii/framework/web/CWebApplication.php(141): CWebApplication->runController()
#29 + /var/www/limesurvey/vendor/yiisoft/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#30 + /var/www/limesurvey/index.php(161): CApplication->run()
2023-11-09 09:14:27 Apache Yii Framework/1.1.2
|
|
|
Issue in the plugin : https://manual.limesurvey.org/Dynamic_model_events
PS : save as HTML the error is really more easy to read |
|
|
PS : save as HTML the error is really more easy to read
Yes, I know, I hadn't had this like that :)
Save as PDF is even better. |
|
|
Issue in the plugin : https://manual.limesurvey.org/Dynamic_model_events
I believe the best is to just rename the event on dev.
beforeTokenDelete --> beforeTokenDeleteManually |
|
|
Save as PDF is even better.
O no !
Clearly as HTML : you have whole page
I believe the best is to just rename the event on dev.
No ! it's an issue in the plugin, all ModelVeent receive model and not model->primaryKey
The issue is here : https://github.com/LimeSurvey/LimeSurvey/blob/b647c39b3c1ccf9dfc7375c83f58f4293b570fbf/application/core/plugins/AuditLog/AuditLog.php#L385
And for BeforeDeleteMany filterCriteria
See BeforeTokenSave
https://github.com/LimeSurvey/LimeSurvey/blob/7841783033bdf80f1b4a2ecc84f1f1153924028b/plugins/AuditLog/AuditLog.php#L342
or beforeParticipantDelete
https://github.com/LimeSurvey/LimeSurvey/blob/7841783033bdf80f1b4a2ecc84f1f1153924028b/plugins/AuditLog/AuditLog.php#L451 |
|
|
Clearly as HTML : you have whole page
As PDF as well.
Look at this:
https://github.com/LimeSurvey/LimeSurvey/blob/b647c39b3c1ccf9dfc7375c83f58f4293b570fbf/application/controllers/admin/Tokens.php#L895 |
|
|
Look at this:
Arg … it's a specific one then …
Unsure if both happen ? |
|
|
You know where this delete action is done ? |
|
|
OK,
I think both can happen
Maybe just fix
$sTokenIds = $this->getEvent()->get('sTokenIds');
if (!$sTokenIds) {
return;
}
$aTokenIds = array_filter(explode(',', (string) $sTokenIds));
etc …
PS : you can fix it, don't really want to fix it …
PS : with pdf : you can not click on + to show hide content |
|
|
That could work, but wouldn't be logging in case someone deletes the model from a plugin, for example.
Also, to note, I believe deleteByPk is not triggering the events. |
|
|
Also, to note, I believe deleteByPk is not triggering the events.
Unsure here |
|
|
Also, to note, I believe deleteByPk is not triggering the events.
https://forum.yiiframework.com/t/before-after-delete-strange-behavior/16050/4
Maybe on LSActiveRecord or on some classes we should overload deleteByPk() and deleteAll() as to make sure the events get triggered?
@ollehar ? |
|
|
Maybe on LSActiveRecord or on some classes we should overload deleteByPk() and deleteAll() as to make sure the events get triggered?
New feature :) and add deleteAllByAttributes
maybe with a different name ? Or an extra param ?
Else : we have same issue with updateAll or updateByPk or updateByAttributes |
|