Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fix SQL warning when no user session is active during plugin init
- Fix text area fields alignment
- Fix error when submitting a form with an hidden question of type `Field`
- Fixed a bug where a field was deleted when at least one question in a form was linked to another field
Expand Down
8 changes: 8 additions & 0 deletions inc/questiontype.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,15 @@ private function getAvailableBlocks(): array
$field_container = new PluginFieldsContainer();
$available_blocks = [];

// No session and not CLI: return early to avoid invalid SQL criterion from
// getEntitiesRestrictCriteria() (returns entities_id = '' on integer column,
// producing MySQL warning 1292). Consistent with the guard in setup.php.
if (!Session::getLoginUserID() && !isCommandLine()) {
return $available_blocks;
}

$entity_restrict = isCommandLine() ? [] : getEntitiesRestrictCriteria(PluginFieldsContainer::getTable(), '', '', true);

$result = $field_container->find([
'is_active' => 1,
'type' => 'dom',
Expand Down