Adding many Form Elements at once raises Exception

Permalink 11 8 Browser Info Environment
How to reproduce:

- Add a Form Block(not Legacy) to a page
- Add Add > 3 Question Elements of the type "Text" at once
- Hit the Add Button

Then following Exception is raised and the Block is not saved.:

// exclude verbose information (e.g. exception stack traces) if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) { $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE); // Symfony VarDumper 2.6 Caster class dont exist. } else { $cloneVar = $this->getCloner()->cloneVar($value); } $dumper->dump( $cloneVar, $this->htmlDumperOutput ); $output = $this->htmlDumperOutput->getOutput(); $this->htmlDumperOutput->clear(); return $output; } return print_r($value, true); } /** * Format the args of the given Frame as a human readable html string * * @param Frame $frame * @return string the rendered html */ public function dumpArgs(Frame $frame) { // we support frame args only when the optional dumper is available if (!$this->getDumper()) { return ''; } $html = ''; $numFrames = count($frame->getArgs()); if ($numFrames > 0) { $html = '
';


Status: New
Remo replied on at Permalink Reply 1 Attachment
Remo
I can confirm this. Attached is the complete error message, fails due to a memory limit problem.
haeflimi replied on at Permalink Reply
haeflimi
Just tested this in 8.3 - The problem is still here.
JeffPaetkau replied on at Permalink Reply
I'm seeing this bug as well. Very annoying to spend 10 minutes adding 20 fields then have it flake out :(
JeffPaetkau replied on at Permalink Reply
Just tested in 8.4.0 and I get this exception

An unexpected error occurred. A managed+dirty entity Concrete\Core\Entity\Attribute\Key\Settings\[email protected] can not be scheduled for insertion.
JeffPaetkau replied on at Permalink Reply
How is it that such a critical block can be so non-functional?
JeffPaetkau replied on at Permalink Reply
JeffPaetkau replied on at Permalink Reply
ORM uses spl_object_hash() to keep track of it's objects. This bug is because that function is generating a duplicate id. ID's are guaranteed to be unique as long as the object still exists in memory. However, if the object no longer exists in memory it is probably a collision will occur. This is what is happening.

See the code here where the exception is raised:
concrete/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:1212

However, the actual bug is somewhere near here:
/concrete/blocks/express_form/controller.php:481

I only have a shaky (at best) understanding of what this code is doing so I'll let someone else turn this into a proper fix. However, the following code does fix the bug. Replace lines 463 to 486 with the following:

$key = $control->getAttributeKey();
$type = $key->getAttributeType();
$settings = $key->getAttributeKeySettings();
// We have to merge entities back into the entity manager because they have been
// serialized. First type, because if we merge key first type gets screwed
$type2 = $entityManager->merge($type);
// Now key, because we need key to set as the primary key for settings.
$key2 = $entityManager->merge($key);
$key2->setAttributeType($type2);
$key2->setEntity($entity);
$key2->setAttributeKeyHandle((new AttributeKeyHandleGenerator($attributeKeyCategory))->generate($key2));
$entityManager->persist($key2);
$entityManager->flush();
// Now attribute settings.
$settings->setAttributeKey($key2);

concrete5 Environment Information

# concrete5 Version
Core Version - 8.3.0a1
Version Installed - 8.3.0a1
Database Version - 20170915000000

# concrete5 Packages
Mesch URL Director (2.8)

# concrete5 Overrides
blocks/mesch_filter_list/templates/picture_text.php, blocks/mesch_filter_list/templates/newsletter.php, blocks/mesch_filter_list/templates, blocks/mesch_filter_list/view.php, blocks/mesch_filter_list/view.js, blocks/mesch_filter_list/elements/user_list_row.php, blocks/mesch_filter_list/elements/page_list_row.php, blocks/mesch_filter_list/elements/_readme.txt, blocks/mesch_filter_list/elements/file_list_row.php, blocks/mesch_filter_list/elements, blocks/mesch_filter_list, blocks/horizontal_rule/templates/newsletter.php, blocks/horizontal_rule/templates, blocks/horizontal_rule, blocks/share_this_page/view.php, blocks/share_this_page, blocks/file/templates/newsletter.php, blocks/file/templates, blocks/file, blocks/search/view.php, blocks/search, blocks/content/templates/newsletter.php, blocks/content/templates, blocks/content/controller.php, blocks/content/view.css, blocks/content/view.php, blocks/content, blocks/image/templates/newsletter.php, blocks/image/templates, blocks/image/controller.php, blocks/image, blocks/page_list/view.php, blocks/page_list, blocks/page_title/templates/newsletter.php, blocks/page_title/templates, blocks/page_title, blocks/autonav/templates/mesch_bootstrap_navbar_fixed.php, blocks/autonav/templates/mesch_bootstrap_navbar_default_streched/view.php, blocks/autonav/templates/mesch_bootstrap_navbar_default_streched/view.js, blocks/autonav/templates/mesch_bootstrap_navbar_default_streched, blocks/autonav/templates/mesch_bootstrap_navbar_default.php, blocks/autonav/templates/mesch_bootstrap_navbar_mobile_only_focus.php, blocks/autonav/templates/mesch_bootstrap_navbar_basic.php, blocks/autonav/templates/mesch_bootstrap_sidenav_accordion.php, blocks/autonav/templates/mesch_bootstrap_sidenav_focus.php, blocks/autonav/templates/mesch_bootstrap_mobile_footer_buttons.php, blocks/autonav/templates/mesch_bootstrap_responsive_breadcrumb/view.css, blocks/autonav/templates/mesch_bootstrap_responsive_breadcrumb/view.php, blocks/autonav/templates/mesch_bootstrap_responsive_breadcrumb, blocks/autonav/templates/mesch_bootstrap_navbar_mobile_only_plain.php, blocks/autonav/templates/mesch_bootstrap_navbar_mobile_only.php, blocks/autonav/templates/mesch_bootstrap_breadcrumb.php, blocks/autonav/templates, blocks/autonav, blocks/mesch_search/view.php, blocks/mesch_search, blocks/mesch_image_button_text/templates/newsletter_bild_links.php, blocks/mesch_image_button_text/templates/newsletter_bild_ganze_breite.php, blocks/mesch_image_button_text/templates/newsletter_bild_auf_inhaltsbreite.php, blocks/mesch_image_button_text/templates/newsletter_bild_rechts.php, blocks/mesch_image_button_text/templates, blocks/mesch_image_button_text, themes/meschatomicbootstrap/default.php, themes/meschatomicbootstrap/page_theme.php, themes/meschatomicbootstrap/right_sidebar.php, themes/meschatomicbootstrap/README.MD, themes/meschatomicbootstrap/full.php, themes/meschatomicbootstrap/left_sidebar.php, themes/meschatomicbootstrap/thumbnail.png, themes/meschatomicbootstrap/js/theme.js, themes/meschatomicbootstrap/js/bootstrap/tooltip.js, themes/meschatomicbootstrap/js/bootstrap/tab.js, themes/meschatomicbootstrap/js/bootstrap/transition.js, themes/meschatomicbootstrap/js/bootstrap/popover.js, themes/meschatomicbootstrap/js/bootstrap/collapse.js, themes/meschatomicbootstrap/js/bootstrap/modal.js, themes/meschatomicbootstrap/js/bootstrap/alert.js, themes/meschatomicbootstrap/js/bootstrap/scrollspy.js, themes/meschatomicbootstrap/js/bootstrap/button.js, themes/meschatomicbootstrap/js/bootstrap/dropdown.js, themes/meschatomicbootstrap/js/bootstrap/affix.js, themes/meschatomicbootstrap/js/bootstrap/carousel.js, themes/meschatomicbootstrap/js/bootstrap, themes/meschatomicbootstrap/js, themes/meschatomicbootstrap/mockup.php, themes/meschatomicbootstrap/css/newsletter.less, themes/meschatomicbootstrap/css/atomic_bootstrap.less, themes/meschatomicbootstrap/css/project/templates/page-template-default.less, themes/meschatomicbootstrap/css/project/templates/page-not-found.less, themes/meschatomicbootstrap/css/project/templates/login.less, themes/meschatomicbootstrap/css/project/templates, themes/meschatomicbootstrap/css/project/organisms/carousel.less, themes/meschatomicbootstrap/css/project/organisms/share-this-page.less, themes/meschatomicbootstrap/css/project/organisms/paginations.less, themes/meschatomicbootstrap/css/project/organisms/mesch-gallery.less, themes/meschatomicbootstrap/css/project/organisms/mesch-gmaps.less, themes/meschatomicbootstrap/css/project/organisms/mesch-form.less, themes/meschatomicbootstrap/css/project/organisms/modals.less, themes/meschatomicbootstrap/css/project/organisms/navbars.less, themes/meschatomicbootstrap/css/project/organisms/breadcrumbs.less, themes/meschatomicbootstrap/css/project/organisms/mesch-filter-list.less, themes/meschatomicbootstrap/css/project/organisms/datepicker.less, themes/meschatomicbootstrap/css/project/organisms/mesch-image-button-text.less, themes/meschatomicbootstrap/css/project/organisms, themes/meschatomicbootstrap/css/project/atoms/buttons.less, themes/meschatomicbootstrap/css/project/atoms/close.less, themes/meschatomicbootstrap/css/project/atoms/tables.less, themes/meschatomicbootstrap/css/project/atoms/code.less, themes/meschatomicbootstrap/css/project/atoms/grid.less, themes/meschatomicbootstrap/css/project/atoms/typography.less, themes/meschatomicbootstrap/css/project/atoms/fonts.less, themes/meschatomicbootstrap/css/project/atoms/icons.less, themes/meschatomicbootstrap/css/project/atoms/containers.less, themes/meschatomicbootstrap/css/project/atoms/colors.less, themes/meschatomicbootstrap/css/project/atoms/inputs.less, themes/meschatomicbootstrap/css/project/atoms, themes/meschatomicbootstrap/css/project/molecules/scroll-to-top.less, themes/meschatomicbootstrap/css/project/molecules/progress-bars.less, themes/meschatomicbootstrap/css/project/molecules/list-groups.less, themes/meschatomicbootstrap/css/project/molecules/tooltips.less, themes/meschatomicbootstrap/css/project/molecules/wells.less, themes/meschatomicbootstrap/css/project/molecules/media.less, themes/meschatomicbootstrap/css/project/molecules/search-results.less, themes/meschatomicbootstrap/css/project/molecules/badges.less, themes/meschatomicbootstrap/css/project/molecules/thumbnails.less, themes/meschatomicbootstrap/css/project/molecules/dropdowns.less, themes/meschatomicbootstrap/css/project/molecules/alerts.less, themes/meschatomicbootstrap/css/project/molecules/jumbotrons.less, themes/meschatomicbootstrap/css/project/molecules/panels.less, themes/meschatomicbootstrap/css/project/molecules/popovers.less, themes/meschatomicbootstrap/css/project/molecules/labels.less, themes/meschatomicbootstrap/css/project/molecules, themes/meschatomicbootstrap/css/project, themes/meschatomicbootstrap/css/ckeditor.less, themes/meschatomicbootstrap/css/print.less, themes/meschatomicbootstrap/css/redactor.less, themes/meschatomicbootstrap/css/main.less, themes/meschatomicbootstrap/css/bootstrap/progress-bars.less, themes/meschatomicbootstrap/css/bootstrap/tooltip.less, themes/meschatomicbootstrap/css/bootstrap/theme.less, themes/meschatomicbootstrap/css/bootstrap/scaffolding.less, themes/meschatomicbootstrap/css/bootstrap/buttons.less, themes/meschatomicbootstrap/css/bootstrap/button-groups.less, themes/meschatomicbootstrap/css/bootstrap/close.less, themes/meschatomicbootstrap/css/bootstrap/tables.less, themes/meschatomicbootstrap/css/bootstrap/normalize.less, themes/meschatomicbootstrap/css/bootstrap/code.less, themes/meschatomicbootstrap/css/bootstrap/utilities.less, themes/meschatomicbootstrap/css/bootstrap/grid.less, themes/meschatomicbootstrap/css/bootstrap/responsive-embed.less, themes/meschatomicbootstrap/css/bootstrap/carousel.less, themes/meschatomicbootstrap/css/bootstrap/type.less, themes/meschatomicbootstrap/css/bootstrap/input-groups.less, themes/meschatomicbootstrap/css/bootstrap/list-group.less, themes/meschatomicbootstrap/css/bootstrap/wells.less, themes/meschatomicbootstrap/css/bootstrap/media.less, themes/meschatomicbootstrap/css/bootstrap/variables.less, themes/meschatomicbootstrap/css/bootstrap/navs.less, themes/meschatomicbootstrap/css/bootstrap/modals.less, themes/meschatomicbootstrap/css/bootstrap/breadcrumbs.less, themes/meschatomicbootstrap/css/bootstrap/badges.less, themes/meschatomicbootstrap/css/bootstrap/forms.less, themes/meschatomicbootstrap/css/bootstrap/mixins/image.less, themes/meschatomicbootstrap/css/bootstrap/mixins/buttons.less, themes/meschatomicbootstrap/css/bootstrap/mixins/tab-focus.less, themes/meschatomicbootstrap/css/bootstrap/mixins/grid.less, themes/meschatomicbootstrap/css/bootstrap/mixins/clearfix.less, themes/meschatomicbootstrap/css/bootstrap/mixins/hide-text.less, themes/meschatomicbootstrap/css/bootstrap/mixins/vendor-prefixes.less, themes/meschatomicbootstrap/css/bootstrap/mixins/gradients.less, themes/meschatomicbootstrap/css/bootstrap/mixins/list-group.less, themes/meschatomicbootstrap/css/bootstrap/mixins/size.less, themes/meschatomicbootstrap/css/bootstrap/mixins/background-variant.less, themes/meschatomicbootstrap/css/bootstrap/mixins/nav-divider.less, themes/meschatomicbootstrap/css/bootstrap/mixins/nav-vertical-align.less, themes/meschatomicbootstrap/css/bootstrap/mixins/text-emphasis.less, themes/meschatomicbootstrap/css/bootstrap/mixins/opacity.less, themes/meschatomicbootstrap/css/bootstrap/mixins/progress-bar.less, themes/meschatomicbootstrap/css/bootstrap/mixins/forms.less, themes/meschatomicbootstrap/css/bootstrap/mixins/text-overflow.less, themes/meschatomicbootstrap/css/bootstrap/mixins/center-block.less, themes/meschatomicbootstrap/css/bootstrap/mixins/alerts.less, themes/meschatomicbootstrap/css/bootstrap/mixins/panels.less, themes/meschatomicbootstrap/css/bootstrap/mixins/reset-filter.less, themes/meschatomicbootstrap/css/bootstrap/mixins/resize.less, themes/meschatomicbootstrap/css/bootstrap/mixins/reset-text.less, themes/meschatomicbootstrap/css/bootstrap/mixins/grid-framework.less, themes/meschatomicbootstrap/css/bootstrap/mixins/table-row.less, themes/meschatomicbootstrap/css/bootstrap/mixins/labels.less, themes/meschatomicbootstrap/css/bootstrap/mixins/responsive-visibility.less, themes/meschatomicbootstrap/css/bootstrap/mixins/border-radius.less, themes/meschatomicbootstrap/css/bootstrap/mixins/pagination.less, themes/meschatomicbootstrap/css/bootstrap/mixins, themes/meschatomicbootstrap/css/bootstrap/print.less, themes/meschatomicbootstrap/css/bootstrap/component-animations.less, themes/meschatomicbootstrap/css/bootstrap/thumbnails.less, themes/meschatomicbootstrap/css/bootstrap/docs.min.css, themes/meschatomicbootstrap/css/bootstrap/dropdowns.less, themes/meschatomicbootstrap/css/bootstrap/alerts.less, themes/meschatomicbootstrap/css/bootstrap/glyphicons.less, themes/meschatomicbootstrap/css/bootstrap/panels.less, themes/meschatomicbootstrap/css/bootstrap/pager.less, themes/meschatomicbootstrap/css/bootstrap/popovers.less, themes/meschatomicbootstrap/css/bootstrap/navbar.less, themes/meschatomicbootstrap/css/bootstrap/jumbotron.less, themes/meschatomicbootstrap/css/bootstrap/mixins.less, themes/meschatomicbootstrap/css/bootstrap/bootstrap.less, themes/meschatomicbootstrap/css/bootstrap/labels.less, themes/meschatomicbootstrap/css/bootstrap/responsive-utilities.less, themes/meschatomicbootstrap/css/bootstrap/pagination.less, themes/meschatomicbootstrap/css/bootstrap, themes/meschatomicbootstrap/css, themes/meschatomicbootstrap/view.php, themes/meschatomicbootstrap/elements/footer.php, themes/meschatomicbootstrap/elements/header_top.php, themes/meschatomicbootstrap/elements/header.php, themes/meschatomicbootstrap/elements/footer_bottom.php, themes/meschatomicbootstrap/elements, themes/meschatomicbootstrap/page_forbidden.php, themes/meschatomicbootstrap/images/select_icon.png, themes/meschatomicbootstrap/images, themes/meschatomicbootstrap/page_not_found.php, themes/meschatomicbootstrap/newsletter.php, themes/meschatomicbootstrap/login.php, themes/meschatomicbootstrap/blank.php, themes/meschatomicbootstrap, src/Mail/Service/Obfuscator.php, src/Mail/Service, src/Mail

# concrete5 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
fpm-fcgi

# PHP Version
7.0.22-0ubuntu0.16.04.1

# PHP Extensions
calendar, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, intl, json, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, sockets, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 600
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 600
max_input_vars - 1000
memory_limit - 128M
post_max_size - 128M
sql.safe_mode - Off
upload_max_filesize - 128M
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
opcache.max_accelerated_files - 2000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36