The error is:

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'nid' at row 1: INSERT INTO {menu_node} (nid, mlid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 6705/ [:db_insert_placeholder_1] => 2109 ) in menu_node_enable() (line 59 of /var/aegir/platforms/soa.utexas.edu/sites/all/modules/menu_node/menu_node.install).

Attached patch casts the nid to an int to truncate that extra slash before it gets to the db layer. Not sure why that extra slash exists but if ti does it should be removed im sure.

* Graciously sponsored by the School of Architecture at the University of Texas

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

That's pretty weird. You have any idea what database row causes this to choke? I'd like to see that data.

And doesn't db_insert() handle this for us?

audealexandre’s picture

Hi,

Maybe the following can help: I had a similar problem when installing the module :error message: "1265 data truncated for column "nid" at row 1 [...]". The problem came from the use of tokens in the menu link (module Menu tokens), which tried to insert in the table nid such as "24?lib=[node:nid]". When I delete these menu items, it worked perfectly. Maybe just add a verification before inserting the nid into the table?

agentrickard’s picture

That sounds like the missing information we need, yes.

gabriel.achille’s picture

@audealexandre, @michaelfavia:
I can't reproduce the bug: having latest release of Menu token installed (7.x-1.0-beta4), + some 'menu token' links created like "node/1?lib=[node:nid]". No errors are raised when enabling module menu_node. And according to how Menu token is storing data now into menu_links table i don't see how there could be the error mentionned above...
Feel free to explain more your particular problem if it is still present.

gabriel.achille’s picture

Status: Needs review » Closed (cannot reproduce)
Renee S’s picture

Status: Reviewed & tested by the community » Active
FileSize
58.45 KB

Same problem, here, when updating to the latest dev. gabriel.achille, did you try upgrading from an earlier version with data, rather than enabling it fresh? That may be the steps to reproduce.

The following updates returned messages

menu_node module

Update #7100
Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'nid' at row 1: INSERT INTO {menu_node} (nid, mlid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 15/members [:db_insert_placeholder_1] => 10248 ) in menu_node_enable() (line 58 of /sites/all/modules/contrib/menu_node/menu_node.install).

Renee S’s picture

Confirmed, the patch fixed this for me. I believe in my case it wasn't menu_token, it was a temporary hardcoded (not %1) views path. Same issue. Thanks!

eta: I do wonder about casting the result, as it might lead to indeterminent states if the str_replace returns false, like it would with my path of "15/members". But, hmm.

Renee S’s picture

Status: Closed (cannot reproduce) » Reviewed & tested by the community
Renee S’s picture

Status: Active » Needs work
leymannx’s picture

Patch works! Thanks!

kaldimar’s picture

Issue summary: View changes

Got the same issue while installing the module, in this case because some menu links have custom paths like node/66/about/highlights. Patch provided by the OP works fine and should be committed.

dgtlmoon’s picture

Status: Needs work » Reviewed & tested by the community

In my case the patch also fixed my problem, I am using 'nodesymlinks' module which gives path such as '741/mid/9216', casting '741/mid/9216' to (int) yields 741 correctly and module installed just fine, please commit

DrupalGideon’s picture

This patch (although old) worked for me as well

For some reason I had link_path of "node/xxxxx/" in my menu_links table and I don't have any of the above modules mentioned installed so I would like to see this added if possible.

codevoice’s picture

This patch worked well for me as well, fixed the problem described.

ordermind’s picture

Patch works for me too and is quite safe. Please commit.

gabriel.achille’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.53 KB

The issue is located in the hook_enable, for some uncommon drupal node path: when a module has added a parameter after the nid.

I tried to make a more generic patch to cover the reported issues: node/123?arg1=value1 ; node/123/extra/path and one other : node/123#fragment
I'm using a regexp to match an integer value to avoid the possible issue noticed by renee-s in #7.

Tested ok for me.

Status: Needs review » Needs work

The last submitted patch, 16: install_fails_exception-1691508-16.patch, failed testing.

joelpittet’s picture

@gabriel.achille how about using parse_url()from PHP and drupal's arg()?

$path = 'node/321#fragment';
// $path = '';
// $path = 'node/123/extra/path';
// $path = 'node/';
$url = $path;
$components = parse_url($url);
print arg(1, $components['path']);

That should deal with the #fragment

gabriel.achille’s picture

Status: Needs work » Needs review
FileSize
1.56 KB

@joelpittet
I agree and it looks cleaner to me. Here a proposition of patch. I keep a test on the integer value of nid because it seems still necessary for me.
Tested ok for me.

RoSk0’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #19 looks good and fixes the issue for us. Previously was using cast_to_int.patch.

  • vuil committed e15380b on 7.x-1.x authored by gabriel.achille
    Issue #1691508 by gabriel.achille, Renee S, vuil: Install fails with...
vuil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.