After updating to the newest 7.x-3.0-beta 1 version of content_lock, the "Cancel Edit" button on any node edit form causes a PHP Fatal error (and returns a 500 server error).

The error message: PHP Fatal error: Call to undefined function _content_lock_node_form_handler_cancel_submit() in /data/virtual/common/drupal/includes/form.inc on line 1520.

A content lock still seems to be placed, and can be removed by viewing the node and using the "release the lock" link, but it seems like a fairly major bug.

Note: this occurs using the latest version of Drupal core (7.54).

CommentFileSizeAuthor
#11 cancel-edit-fix-2852631.patch1.22 KBscotwith1t

Comments

mjchadwick created an issue. See original summary.

jaydub’s picture

Some more details, the undefined function is in the file ./includes/content_lock.node.inc and the only reference to the function is also in that include file as a function passed to #validate array attribute of a form API cancel button:

    // If we're editing a node (not adding).
    else {
      if ($node->nid) {
        $form['actions']['cancel'] = array(
          '#type' => 'button',
          '#weight' => 2000,
          '#value' => t('Cancel edit'),
          '#validate' => array('_content_lock_node_form_handler_cancel_submit'),
        );

        if (isset($form['actions']['delete'])) {
          $form['actions']['delete']['#weight'] = 2001;
        }
      }
    }

Given that the new version of Content Lock makes use of a bunch of files in ./includes that are loaded by various module_load_include() calls I would guess that when the form is canceled and the 'validate' handler is run, the module_load_include() pipeline is not or has not been initiated and so the function contained in the include file is not available to PHP.

  • Joseph Zhao committed bb6b376 on 7.x-3.x
    Issue #2852631 by mjchadwick, jaydub, Joseph Zhao: Cancel Edit button...
devpilot’s picture

I moved function _content_lock_node_form_handler_cancel_submit() into the .module file

Now that function is available regardless of include state.

ebarrette’s picture

Having the same issue when clicking the "Cancel Edit" button.

Using Drupal 7.54 and Content Lock version 7.x-3.0-beta1

panshulk’s picture

Hi
i came across the same issue where on pressing "Cancel Edit" i was facing WSOD (White Screen On Death), the error logs reported the same error mentioned above. Changes in #3 resolved the issue.
It would be great if we can include this change in a release.
Thanks :)

marcelovani’s picture

I would recommend the maintainer to create a tag.
The latest tag is not stable as it causes a fatal error without this fix.

jcaprio_nwe’s picture

Having Same Issue, Drupal 7.56
Content Lock Version: 7.x-3.0-beta1

szeidler’s picture

I also fell into the trap today. It would be really nice to tag a release including the commit.

helmo’s picture

+1 for a beta2 or full release.

scotwith1t’s picture

Version: 7.x-3.0-beta1 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
1.22 KB

Here's a patch. This is definitely major and has to be fixed in next version please! Thanks!

senortim’s picture

+1 that the patch worked fine and for release.

vacilando’s picture

Status: Needs review » Reviewed & tested by the community

+1 the patch is perfectly OK; please make a dev release as soon as possible please. I think this is ready to be set as RTBC as well.

yan’s picture

I can confirm, too, that patch from #11 solves the problem.

Amir Simantov’s picture

Patch #11 worked for me. 7.x-3.0-beta1