Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#10 | hidden-fatal-PDO-403526-10.patch | 3.96 KB | pwolanin |
#8 | hidden-fatal-PDO-403526-7.patch | 4.09 KB | pwolanin |
#6 | hidden-fatal-PDO-403526-6.patch | 5.73 KB | pwolanin |
#5 | hidden-fatal-PDO-403526-4.patch | 2.61 KB | pwolanin |
#3 | fatal-PDO-test-only-403526-3.patch | 3.12 KB | pwolanin |
Comments
Comment #1
pwolanin CreditAttribution: pwolanin commented(note - line number of the exception above is off a little since I was working on another patch at the time).
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedI agree that this is critical (obviously), but we need to add a test for that.
Comment #3
pwolanin CreditAttribution: pwolanin commentedOk, 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.
Comment #5
pwolanin CreditAttribution: pwolanin commentedcombined patch with new test + patch.
Comment #6
pwolanin CreditAttribution: pwolanin commentedwhoops - didn't have the test
Comment #7
webchickThe 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.
Comment #8
pwolanin CreditAttribution: pwolanin commentedPer discussion w/ webchick - a minimal fix in the offending menu module form with a deeper DBTNG fix to be considered separately.
Comment #9
pwolanin CreditAttribution: pwolanin commentedbroader DBTNG issue: http://drupal.org/node/403840
Comment #10
pwolanin CreditAttribution: pwolanin commentedExtra code comment to clarify the logic.
Comment #11
webchickCommitted with a few minor comment spacing fixes. Thanks!