Integrity Constraint Violation error when adding calendar event

So I installed Concrete on my local machine in order to build a website for a client. I used the Atomik theme, added a calendar, then went to add a calendar event. However I got an error message:

An exception occurred while executing 'INSERT INTO CalendarEvents (hasCustomSummaryTemplates, caID) VALUES (?, ?)' with params [0, 1]:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`reh`.`calendarevents`, CONSTRAINT `FK_7F23C55611C85723` FOREIGN KEY (`caID`) REFERENCES `Calendars` (`caID`))

Details

C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\AbstractMySQLDriver.php(68): Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException->null	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php(182): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php(159): Doctrine\DBAL\DBALException->wrapException	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Connection.php(2226): Doctrine\DBAL\DBALException->driverExceptionDuringQuery	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php(185): Doctrine\DBAL\Connection->handleExceptionDuringQuery	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO\Exception.php(18): Doctrine\DBAL\Driver\PDO\Exception->null	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php(119): Doctrine\DBAL\Driver\PDO\Exception->new	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php(117): PDOException->null	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php(117): PDOStatement->execute	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php(179): Doctrine\DBAL\Driver\PDOStatement->execute	
C:\xampp\htdocs\reh\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php(226): Doctrine\DBAL\Statement->execute	
C:\xampp\htdocs\reh\vendor\doctrine\orm\lib\Doctrine\ORM\Persisters\Entity\BasicEntityPersister.php(278): Doctrine\DBAL\Statement->executeStatement	
C:\xampp\htdocs\reh\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php(1133): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->executeInserts	
C:\xampp\htdocs\reh\vendor\doctrine\orm\lib\Doctrine\ORM\UnitOfWork.php(430): Doctrine\ORM\UnitOfWork->executeInserts	
C:\xampp\htdocs\reh\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php(403): Doctrine\ORM\UnitOfWork->commit	
C:\xampp\htdocs\reh\public\concrete\src\Calendar\Event\EventService.php(138): Doctrine\ORM\EntityManager->flush	
C:\xampp\htdocs\reh\public\concrete\src\Calendar\Event\EventService.php(132): Concrete\Core\Calendar\Event\EventService->save	
C:\xampp\htdocs\reh\public\concrete\controllers\dialog\event\edit.php(174): Concrete\Core\Calendar\Event\EventService->addEventVersion	
C:\xampp\htdocs\reh\public\concrete\controllers\dialog\event\edit.php(224): Concrete\Controller\Dialog\Event\Edit->addCalendarEventVersionFromRequest	
C:\xampp\htdocs\reh\public\concrete\src\Controller\AbstractController.php(318): Concrete\Controller\Dialog\Event\Edit->addEvent	
C:\xampp\htdocs\reh\public\concrete\src\Controller\AbstractController.php(318): null->call_user_func_array	
C:\xampp\htdocs\reh\public\concrete\src\Routing\ControllerRouteAction.php(64): Concrete\Core\Controller\AbstractController->runAction	
C:\xampp\htdocs\reh\public\concrete\src\Http\RouteDispatcher.php(37): Concrete\Core\Routing\ControllerRouteAction->execute	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\DispatcherDelegate.php(39): Concrete\Core\Http\RouteDispatcher->dispatch	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareStack.php(86): Concrete\Core\Http\Middleware\DispatcherDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\DefaultDispatcher.php(127): Concrete\Core\Http\Middleware\MiddlewareStack->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\DefaultDispatcher.php(60): Concrete\Core\Http\DefaultDispatcher->handleDispatch	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\DispatcherDelegate.php(39): Concrete\Core\Http\DefaultDispatcher->dispatch	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\FrameOptionsMiddleware.php(39): Concrete\Core\Http\Middleware\DispatcherDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\FrameOptionsMiddleware->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\StrictTransportSecurityMiddleware.php(36): Concrete\Core\Http\Middleware\MiddlewareDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\StrictTransportSecurityMiddleware->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\ContentSecurityPolicyMiddleware.php(36): Concrete\Core\Http\Middleware\MiddlewareDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\ContentSecurityPolicyMiddleware->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\CookieMiddleware.php(35): Concrete\Core\Http\Middleware\MiddlewareDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\CookieMiddleware->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\ApplicationMiddleware.php(29): Concrete\Core\Http\Middleware\MiddlewareDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareDelegate.php(50): Concrete\Core\Http\Middleware\ApplicationMiddleware->process	
C:\xampp\htdocs\reh\public\concrete\src\Http\Middleware\MiddlewareStack.php(86): Concrete\Core\Http\Middleware\MiddlewareDelegate->next	
C:\xampp\htdocs\reh\public\concrete\src\Http\DefaultServer.php(85): Concrete\Core\Http\Middleware\MiddlewareStack->process	
C:\xampp\htdocs\reh\public\concrete\src\Foundation\Runtime\Run\DefaultRunner.php(125): Concrete\Core\Http\DefaultServer->handleRequest	
C:\xampp\htdocs\reh\public\concrete\src\Foundation\Runtime\DefaultRuntime.php(102): Concrete\Core\Foundation\Runtime\Run\DefaultRunner->run	
C:\xampp\htdocs\reh\public\concrete\dispatcher.php(45): Concrete\Core\Foundation\Runtime\DefaultRuntime->run	
C:\xampp\htdocs\reh\public\index.php(3): null->require

The calendar event is as simple as you can get. The title is “test”, the description is “test”, and I’m using the default date and time. Nothing else.

I haven’t made any major changes to the site, asides from editing the content like one normally would. I also got an error while attempting to update to the latest version, but I’ll make a separate post about that.

I’m not able to provide my environment information because going to Dashboard > System & Settings > Environment > Environment Information just yields Unable to load environment info

However I’m running:

  • Concrete CMS: 9.1.1
  • PHP: 8.1.6
  • MariaDB: 10.4.24
  • Apache: 2.4.53
  • Composer: 2.4.2

This is a purely vanilla installation. I haven’t installed any third party extensions or themes. The most I’ve done is edit content, replaced some images using the file manager, and set up a form or two.

Is there anything I can do to work around this issue? Because my entire project is held up because being able to have a functional calendar is a critical part of the site

@Grayda Do you have the same issue with a 9.1.3 install?

Hi @Grayda -

I’m not able to recreate that on a vanilla install of 9.1.1 on PHP 8.1.12 - added calendar called test, added event titled “test” with “test” in the description - worked fine.

It is troubling that your environment info isn’t returning correctly - seems like there might be something else going on with your environment. Here’s my environment info for reference:

# Concrete Version
Core Version - 9.1.1
Version Installed - 9.1.1
Database Version - 20220516191423

# Database Information
Version: 10.3.37-MariaDB
SQL Mode: NO_ENGINE_SUBSTITUTION

# Concrete Packages
Nestable Manual Nav (9.0.0)

# Concrete Overrides
None

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
8.1.12

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
upload_max_filesize - 2M
zend.exception_string_param_max_len - 15
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
unserialize_max_depth - 4096