When the node add form is being loaded, the contentanalysis module will init a node object on node/add.
Here's the code in question:

From line 246 onwards in contentanalysis.module:

  // init node value if node/add
  if(!isset($node->nid) || !$node || !$node->nid) {
    // Load the next nid from the table
    if (!$node->nid = (int)db_next_id(db_query('SELECT MAX(nid) FROM {node}')->fetchField())) {
      $node->nid = -1;
    }
  }

This conflicts with pathauto that expects the id to be missing for new nodes,
in order to properly tick the checkbox for the "generate url alias" checkbox.

From line 294 in pathauto.module

  if (!isset($entity->path['pathauto'])) {
    if (!empty($id)) {

Can something be done about this?
There might also be other modules that initialize the node id before the vertical tabs in the form are loaded.

Comments

svenryen’s picture

Here's a quick fix...

Replace the two lines in the issue summary with this code

  if (!isset($entity->path['pathauto'])) {
    if (!empty($id) && arg(1) != 'add') {
Dave Reid’s picture

Project: Pathauto » Content Analysis
Version: 7.x-1.0 » 7.x-1.x-dev

That is *SO* a bug in contentanalysis. It should and cannot modify $node->nid in the form for new nodes. That's going to cause multiple failures with other modules.

TomDude48’s picture

Status: Active » Needs review

I have changed the way this is handled in the alpha5 release.

Please update and test.

Dave Reid’s picture

Status: Needs review » Needs work

Doesn't look like this was actually addressed. contentanalysis_analysis_form() is still altering $node->nid to equal -1 for new nodes and this affects other modules (since $node is $form['#node']) since objects are passed by reference by default in PHP 5.

TomDude48’s picture

Status: Needs work » Needs review

Missed that one. There are two forms and only fixed one of them.

They both should work now in the beta release