Hi.
I've been getting mysql_real_escape_string() expects parameter 1 to be string, array given in `includes/database.mysql.inc':321 in my logs when anonymous users visit http://crca.org.au/recent
I'm running Drupal 6.14 with Boost 6.x-1.17 under Nginx. Php version is 5.2.10-1ubuntu1~fpm~jaunty~ppa6.1 with Suhosin Patch 0.9.7.
I installed the trace module, which gave me the following backtrace:
Dec 5 03:16:13 crca drupal: #0675eb7f T+22.213265 [WARNING] E_WARNING: mysql_real_escape_string() expects parameter 1 to be string, array given in `includes/database.mysql.inc':321
Dec 5 03:16:13 crca drupal: return mysql_real_escape_string($text, $active_db);
Dec 5 03:16:13 crca drupal: mysql_real_escape_string(array('page_1', 'page_1'), resource(mysql link)) in `includes/database.mysql.inc':321
Dec 5 03:16:13 crca drupal: db_escape_string(array('page_1', 'page_1')) in `includes/database.inc':225
Dec 5 03:16:13 crca drupal: _db_query_callback(array('%s', '%s'))
Dec 5 03:16:13 crca drupal: preg_replace_callback('/(%d|%s|%%|%f|%b|%n)/', '_db_query_callback', 'SELECT * FROM boost_cache_settings WHERE page_callback = \'%s\' AND page_type = \'%s\' AND base_dir = \'%s\' AND page_id = \'%s\'') in `includes/database.mysql.inc':240
Dec 5 03:16:13 crca drupal: db_query_range('SELECT * FROM {boost_cache_settings} WHERE page_callback = \'%s\' AND page_type = \'%s\' AND base_dir = \'%s\' AND page_id = \'%s\'', 'view', 'RecentPastoralNotesAndBlogs', 'cache/normal/www.crca.org.au', array('page_1', 'page_1'), 0, 1) in `sites/all/modules/boost/boost.module':2579
Dec 5 03:16:13 crca drupal: boost_get_settings_db(array('path' => 'recent', 'load_functions' => '', 'to_arg_functions' => '', 'access_callback' => 'views_access', 'access_arguments' => 'a:2:{i:0;b:1;i:1;b:1;}', 'page_callback' => 'view', 'page_arguments' => array(), 'fit' => '1', 'number_parts' => '1', 'tab_parent' => '', 'tab_root' => 'recent', 'title' => '', 'title_callback' => 't', 'title_arguments' => '', 'type' => '4', 'block_callback' => '', 'description' => '', 'position' => '', 'weight' => '0', 'file' => '', 'href' => 'recent', 'options' => array(), 'access' => TRUE, 'localized_options' => array(), 'map' => array('recent'), 'page_type' => 'RecentPastoralNotesAndBlogs', 'page_id' => array('page_1', 'page_1'))) in `sites/all/modules/boost/boost.module':2149
Dec 5 03:16:13 crca drupal: boost_cache_set('recent', '\n\n
\n\n\n Recent Pastoral Notes/Blog Items | Christian Reformed Churches of Australia\n \n
\n\n
\n
\n
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | boost-651798.patch | 825 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 commentedNice find with the trace module, I'll remember to use that next time I have an ugly error.
The recent page on your site, it's a view correct? page_id is set inside _boost_get_menu_router(), via this
if $router_item['page_arguments'] contains an array in an array then this would cause the error your seeing. Whats special about this view that makes it different from most others? Set the verbose setting to 7 and let me know the output of 'Debug: _boost_ob_handler()' when you hit this page.
Comment #2
nigelcunningham commentedYes, it is a view.
It' set up with unformatted style, node row style, no pager. I can provide screenshots of the config if that will help. Views version is 6.x-2.8.
I get:
Dec 5 05:14:47 crca drupal: http://www.crca.org.au|1259990087|boost|118.209.94.40|http://www.crca.org.au/|http://www.crca.org.au/admin/settings/performance/boost|0||Debug: _boost_ob_handler() HTTP Info: 200 - text/html Path: cache/normal/www.crca.org.au/_.html Content Container: page_manager_page_execute Content Type: front_v2 ID: 4 Cache This: TRUE.
Regards,
Nigel
Comment #3
mikeytown2 commentedID is 4; it should say something like page_1. The output you gave me is for your front page
Path: cache/normal/www.crca.org.au/_.html; appears to be a panel. Can I get the view? I'm fairly certain the error is in _boost_get_menu_router().Comment #4
nigelcunningham commentedOh, sorry. Here's the right one:
Dec 5 05:49:14 crca drupal: http://www.crca.org.au|1259992154|boost|118.209.94.40|http://www.crca.org.au/recent||0||Debug: _boost_ob_handler() HTTP Info: 200 - text/html Path: cache/normal/www.crca.org.au/recent_.html Content Container: view Content Type: RecentPastoralNotesAndBlogs ID: Array Cache This: TRUE.
Comment #5
mikeytown2 commentedWhy it would be having this error doesn't make any sense though... this is the function that renders the view
Heres the code in Boost for grabbing this; so 'page_id' is the same as $display_id
In short, $router_item = menu_get_item(); is returning that in an array for no good reason. I think this issue is related #647946: mysqli_real_escape_string() expects parameter 2 to be string, array given in /database.mysqli.inc on line 323. I need to handle this even though it should "never happen".
Try this patch
Comment #6
nigelcunningham commentedWorks for me; thanks for such a quick response!
Comment #7
mikeytown2 commentedcommitted