Wehn I enabled a module such as 'Forum' is creates a disabled menu link in the Navigation menu. If I go to the menu module Ui and try to enabled the link, I get a fatal uncaught PDO excpetion:

PDOException: UPDATE {menu_links} SET menu_name=:db_update_placeholder_0, plid=:db_update_placeholder_1, link_path=:db_update_placeholder_2, router_path=:db_update_placeholder_3, hidden=:db_update_placeholder_4, external=:db_update_placeholder_5, has_children=:db_update_placeholder_6, expanded=:db_update_placeholder_7, weight=:db_update_placeholder_8, depth=:db_update_placeholder_9, p1=:db_update_placeholder_10, p2=:db_update_placeholder_11, p3=:db_update_placeholder_12, p4=:db_update_placeholder_13, p5=:db_update_placeholder_14, p6=:db_update_placeholder_15, p7=:db_update_placeholder_16, p8=:db_update_placeholder_17, p9=:db_update_placeholder_18, module=:db_update_placeholder_19, link_title=:db_update_placeholder_20, options=:db_update_placeholder_21, customized=:db_update_placeholder_22 WHERE (mlid = :db_condition_placeholder_12) - Array ( [:db_update_placeholder_0] => navigation [:db_update_placeholder_1] => 0 [:db_update_placeholder_2] => book [:db_update_placeholder_3] => book [:db_update_placeholder_4] => [:db_update_placeholder_5] => 0 [:db_update_placeholder_6] => 0 [:db_update_placeholder_7] => 0 [:db_update_placeholder_8] => 0 [:db_update_placeholder_9] => 1 [:db_update_placeholder_10] => 139 [:db_update_placeholder_11] => 0 [:db_update_placeholder_12] => 0 [:db_update_placeholder_13] => 0 [:db_update_placeholder_14] => 0 [:db_update_placeholder_15] => 0 [:db_update_placeholder_16] => 0 [:db_update_placeholder_17] => 0 [:db_update_placeholder_18] => 0 [:db_update_placeholder_19] => system [:db_update_placeholder_20] => Books [:db_update_placeholder_21] => a:0:{} [:db_update_placeholder_22] => 1 [:db_condition_placeholder_12] => 139 ) SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'hidden' at row 1 in menu_link_save() (line 2199 of /Users/Shared/www/drupal-7/includes/menu.inc).

This is obviously because we did away with the automatic casting using the %d placeholder (oh,so sad). So, we need to be sure to cast to int all values going into int columns that might contain non-int values.

Comments

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new2.61 KB

(note - line number of the exception above is off a little since I was working on another patch at the time).

damien tournoud’s picture

Status: Needs review » Needs work

I agree that this is critical (obviously), but we need to add a test for that.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new3.12 KB

Ok, test - sacrifice to testbot - should fail.

includes some minor refactoring to make it easier to write the new test condition, plus make existing tests more robust by checking the DB as well as the UI.

Status: Needs review » Needs work

The last submitted patch failed testing.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new2.61 KB

combined patch with new test + patch.

pwolanin’s picture

StatusFileSize
new5.73 KB

whoops - didn't have the test

webchick’s picture

The DX horror of every single query having to cast every integer field to (int) makes me curl up and die a little inside. :P I would much rather DBTNG absorb this requirement to understand the underlying data schema.

pwolanin’s picture

StatusFileSize
new4.09 KB

Per discussion w/ webchick - a minimal fix in the offending menu module form with a deeper DBTNG fix to be considered separately.

pwolanin’s picture

broader DBTNG issue: http://drupal.org/node/403840

pwolanin’s picture

Assigned: Unassigned » pwolanin
StatusFileSize
new3.96 KB

Extra code comment to clarify the logic.

webchick’s picture

Status: Needs review » Fixed

Committed with a few minor comment spacing fixes. Thanks!

Status: Fixed » Closed (fixed)

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