When I check, Reports->Recent log messages, I get the following error for every user when they need menu.
PDOException: in _menu_router_save() (line 3674 of path/drupal/includes/menu.inc)
This seems not to effect to go to the menu related node for users.
I do not know if this effects anything.
Thanks.

Comments

magda_’s picture

I get the same log message. ?

bfroehle’s picture

What is the text of the actual exception? That will be useful for debugging.

hakankahraman66’s picture

StatusFileSize
new66.27 KB

It is the only message that returns.
I checked to learn when it occurs and found that it occurs after "site entry, every node entry and return back from any node."

jordiserra’s picture

Version: 7.0 » 7.8

I am getting the same message "PDOException: in _menu_router_save() (line 3703 of..." but in different line. this line is

$insert->execute();

So it seems to be a problem when drupal saves something in database, maybe the database is corrupted in some way?

Thanks!

Arnion’s picture

In my case: "PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'description' cannot be null: INSERT INTO {menu_router} ... ... in _menu_router_save() (line 3768 of /www/includes/menu.inc)."

Anonymous’s picture

Version: 7.8 » 7.12

Here is my log in Drupal 7.12:

Emplacement http://toto.com/admin/structure/data/create
Référent http://toto.com/admin/structure/data/create
Message PDOException : dans _menu_router_save() (ligne 3811 dans /var/www/toto.com/includes/menu.inc).

jisuo’s picture

Get the same in 7.14

PDOException: in _menu_router_save() (row 3813 of /var/www/drupal/example.com/public_html/includes/menu.inc).

// Execute in batches to avoid the memory overhead of all of those records
    // in the query object.
    if (++$num_records == 20) {
      $insert->execute(); // <--- THIS ROW IS 3813
      $num_records = 0;
    }
julien’s picture

Found the same bug too, but for me it was because a path was declared in a custom module hook_menu which was a drupal core path, and as the path column in the menu_router table is as primary key, i was getting a pdo exeption.

ravi.kumar’s picture

Hi All,

I found the same issue when i give a special character (Búsqueda de Distribuidores) in menu title.

After removing special character the issue was solved for me.

Thanks
Ravi Kumar

evets33’s picture

Hello

I have this message in report journal :

PDOException : dans _menu_router_save() (ligne 3768 dans /.../includes/menu.inc).

I don't have special character. I don't know how can i identify my problem ?

Thank you for your help !

dpovshed’s picture

How it is going with the issue? Wasn't it gone away for you, people, if you:
1) update Drupal to recent version;
and
2) ensure that your Drupal database, at least all system tables, is in UTF8 format?

1420MHz’s picture

I get the same error after updating my local drupal from 7.10 to 7.19 and then to 7.21. With 7.10 everything worked well. After updating to 7.19 the following error started to appear in my log:

Typ Menü
Datum Mittwoch, März 20, 2013 - 00:21
Benutzer admin
Standort http://localhost/(domainName)/www/admin/reports/dblog
Referrer http://localhost/(domainName)/www/admin/reports
Nachricht PDOException: in _menu_router_save() (Zeile 3828 von C:\xampp\htdocs\(domainName)\www\includes\menu.inc).
Schweregrad Fehler
Hostname ::1
Operationen

The error was not fixed by updating from 7.19 to 7.21. It seems to be triggered by simply using the administration menu. When I click some links in the administration menu and go back to the error log, the error message has been repeated.

There is another problem with my drupal that appeared with the update to 7.19, and it is possibly correlated with the error message: The administration menu seems to have update problems. When I add a new content type, I can see it in admin/structure/types. However, it is not listed in node/add. Also, the configuration menu of a module (Availability Calendars) I installed before updating does not show up, when I click on the corresponding link.

Here are lines 3825 - 3830 of menu.inc:

    // Execute in batches to avoid the memory overhead of all of those records
    // in the query object.
    if (++$num_records == 20) {
      $insert->execute();   //<-- This is line 3828
      $num_records = 0;
    }

This part belongs to _menu_router_save($menu, $masks) which "saves data from menu_router_build() to the router table." according to a comment in the code.

I checked my database tables: They are all set to utf8_general_ci

The last thing I did before updating Drupal was installing the Availability Calendars module. (It requires drupal core >= 7.14, which is why I did the update.)

There are no uncommon characters (like ú, see post #9) in my menu names. However, I do use german Umlauts like ä,ö,ü and perhaps also the ß.

Somehow, I belive that my database is corrupted. But I can't figure out, what went wrong.
Does anyone have an idea of how this problem could be fixed?

dpovshed’s picture

Version: 7.12 » 7.21
StatusFileSize
new595 bytes

Thank you 1240MHz for detailed description!

However one of the most important part about error Exception is the text of the Exception message. normally you can view it when you click on log message for details.

Now I can only assume what exactly kind of error you have. I expect this is the same as referred in comment #5 , then the attached patch may help you.

Please try to apply it on 7.21 and let us know.

roman_pro’s picture

found solution here:
http://drupal.org/node/1294432

jjchinquist’s picture

Here is the SQL Exception:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column [error]
'title' cannot be null: INSERT INTO {menu_router} ...

I output the database PDO object to the screen to see which menu router items had a blank title attribute using this code:

    if (++$num_records == 20) {
      if(user_access('administer nodes')){
        drupal_set_message('PDO Object: <pre>' . print_r($insert, 1) . '</pre>');
      }
      $insert->execute();
      $num_records = 0;
    }

The relevant output of the PDO object looks like the following (see delta #13 in both sub-arrays):

[insertFields:protected] => Array
        (
            [0] => path
            [1] => load_functions
            [2] => to_arg_functions
            [3] => access_callback
            [4] => access_arguments
            [5] => page_callback
            [6] => page_arguments
            [7] => delivery_callback
            [8] => fit
            [9] => number_parts
            [10] => context
            [11] => tab_parent
            [12] => tab_root
            [13] => title
            [14] => title_callback
            [15] => title_arguments
            [16] => theme_callback
            [17] => theme_arguments
            [18] => type
            [19] => description
            [20] => position
            [21] => weight
            [22] => include_file
        )
//... removed section ...
    [insertValues:protected] => Array
//... removed section ...
  [11] => Array
                (
                    [0] => classified/%
                    [1] => a:1:{i:1;s:20:"classified_term_load";}
                    [2] => 
                    [3] => user_access
                    [4] => a:1:{i:0;s:14:"access content";}
                    [5] => _classified_page_term
                    [6] => a:1:{i:0;i:1;}
                    [7] => 
                    [8] => 2
                    [9] => 2
                    [10] => 0
                    [11] => 
                    [12] => classified/%
                    [13] => 
                    [14] => filter_admin_format_title
                    [15] => a:1:{i:0;i:1;}
                    [16] => 
                    [17] => a:0:{}
                    [18] => 6
                    [19] => 
                    [20] => 
                    [21] => 0
                    [22] => 

In the /modules/system/system.install file, the schema for the menu_router table says that title can not be NULL, but can be an empty string. A work around would be to default any NULL title to an empty string as follows (patch coming soon so we can test and see if it works):

Line 3814 original

      'title' => $item['title'],

Line 3814 edited

      'title' => (empty($item['title']) ? '' : $item['title']),

Any feedback of integrity in the system due to this change would be welcome!

jjchinquist’s picture

Version: 7.21 » 7.x-dev
Category: support » bug
Status: Active » Needs review
StatusFileSize
new1.37 KB

Changing this to a bug report and 7.x-dev.

I am not certain if the integrity checks should be a part of the contributed module and not a part of core, but hopefully this will do the trick.

Status: Needs review » Needs work

The last submitted patch, PDO-menu-router-item-null-value-exception-1118028-16.patch, failed testing.

tigertrussell’s picture

I have this same error and it's plaguing me! My site is CRAWLING because the menu never gets rebuilt, and it therefore never changes the "menu_rebuild_needed" variable to false. So it rebuilds EVERY TIME.

I don't understand this patch, either... from my debugging steps, $items['title'] is not ever null -- it's just empty. And an empty string like that returns TRUE to empty(), as well!

Has anyone found a real solution / the real cause of this yet?

jjchinquist’s picture

Hi, empty() did the trick for me. But research the opposites:
if (!isset(...)) 1 otherwise 2

or reverse the check
if (!empty()) ... 2 otherwise 1

I can only say that I will look to add a patch again later today, but if none of the values are NULL or empty, then you have a different issue.

tigertrussell’s picture

I applied your patch but found there was one other area where a link_title entry needed to be edited. Now my site works fine -- I just feel like there's an underlying cause that we are not addressing with these particular patches.

jjchinquist’s picture

That I agree with. I did not at the time though go through the backtrace to find where the issue could be coming from. Can you post the backtrace and we can take a look. Can you also post a patch because you said that you had to change "link_title" in a different area. Maybe then we can at least get that patch into core.

maestrojed’s picture

I had this issue. I understood that the title can't be null but I couldn't figure out what the problem module/theme/whatever was. This is a tip on identifying the problem.

It is not a patch or fix. This certainly should not be add to a production site or left in the code.

This also requires the devel module since I use dpm(). You could adjust to report this debug code in some other manor.

Around Line 3798 Find the start of this foreach loop
foreach ($menu as $path => $item) {

and append it so it ends up like this

  foreach ($menu as $path => $item) {
    // Fill in insert object values.
if($item['title']===null){
  dpm($item);
}

This will give you a obj print out of the problem child and you should be able to identify it. Mostly likely you have a problematic module or theme.info file.

xaooosss’s picture

$insert->execute(); dont work

xaooosss’s picture

Status: Needs work » Needs review
Anonymous’s picture

Issue summary: View changes

The null title could be generated by a synthax error in an .info file (module or theme).
Drupal doesn't check the file synthax, so the module or theme is enabled but with a corrupt data structure.
For example if you theme info file begin with

namewq=My theme name

wil generate an theme object with

$theme->info['namewq']; 
//and no 
$theme->info['name']; 
malcomio’s picture

cubeinspire’s picture

In my case the error was produced by a special character on a programmatically created menu item's label.

function chfix_entity_info_alter(&$entity_info) {
  $entity_info['node']['view modes']['busqueda_bulos'] = array(
    'label' => t('Búsqueda bulos'),
    'custom settings' => TRUE,
  );
}

After adding this function on a custom module and cleared the cache the error mentioned appeared.
I edited with nano the file and seen a broken special character, deleting the character, (it was on the ú inside the label), saving the file and clearing the cache solved the issue.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.