warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/cyberfan/htdocs/includes/database.mysql.inc on line 321.

CommentFileSizeAuthor
#24 feed_settings.png13.56 KBDanny_Joris
#24 flickr_xml.png73.19 KBDanny_Joris
#5 err.txt.zip172.78 KBbleen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

IKN’s picture

Same here. Update from alpha to beta5 broke site -- had to roll back.

alex_b’s picture

Status: Active » Postponed (maintainer needs more info)

Needs more info:

- where exactly does this error occur?
- after which actions?

alex_b’s picture

Title: Im receiving this error when trying to change settings after new update. » warning: mysql_real_escape_string()
AntiNSA’s picture

I have completely deleted my old feeds directory uploaded a fresh version of this beta and things cleared up... not sure if it was cash clearing or what..?

bleen’s picture

FileSize
172.78 KB

same problem as original post ...

I'm using D6.19.

Updated to beta5 (from beta4) using drush. Download runs successfully, dbupdate runs fine ... then the next time i do a cache clear I get:

WD php: mysqli_real_escape_string() expects parameter 2 to be string, array given in              [error]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
WD php: mysqli_real_escape_string() expects parameter 2 to be string, array given in              [error]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
WD php: mysqli_real_escape_string() expects parameter 2 to be string, array given in              [error]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
WD php: mysqli_real_escape_string() expects parameter 2 to be string, array given in              [error]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
'all' cache was cleared                                                                           [success]
mysqli_real_escape_string() expects parameter 2 to be string, array given in                      [warning]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
mysqli_real_escape_string() expects parameter 2 to be string, array given in                      [warning]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
mysqli_real_escape_string() expects parameter 2 to be string, array given in                      [warning]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.
mysqli_real_escape_string() expects parameter 2 to be string, array given in                      [warning]
/Users/206093503/Sites/lifegoesstrong.com/www/includes/database.mysqli.inc on line 323.

I get this error consistently on drush cc all ... but i see it sporadically when navigating the site. No pattern that I can discern... I have rolled back my dev site twice and everything gets cleared up. Then when I update feeds I get this error again, so I'm confident that it's the update that is casing this particular issue.

Attached is the backtrace from these errors so (hopefully) you can see what is going on... I might be wrong here, but I suspect that the issue might be in the function feeds_menu() because the source of the error *seems* to be that you're passing in an array for "description" without serializing it. In the excerpt below, check out arg[17]:

[6] => Array
        (
            [file] => /Users/206093503/Sites/lifegoesstrong.com/www/includes/menu.inc
            [line] => 2457
            [function] => db_query
            [args] => Array
                (
                    [0] => INSERT INTO {menu_router}
      (path, load_functions, to_arg_functions, access_callback,
      access_arguments, page_callback, page_arguments, fit,
      number_parts, tab_parent, tab_root,
      title, title_callback, title_arguments,
      type, block_callback, description, position, weight, file)
      VALUES ('%s', '%s', '%s', '%s',
      '%s', '%s', '%s', %d,
      %d, '%s', '%s',
      '%s', '%s', '%s',
      %d, '%s', '%s', '%s', %d, '%s')
                    [1] => node/add/feed-item
                    [2] => 
                    [3] => 
                    [4] => node_access
                    [5] => a:2:{i:0;s:6:"create";i:1;s:9:"feed_item";}
                    [6] => node_add
                    [7] => a:1:{i:0;i:2;}
                    [8] => 7
                    [9] => 3
                    [10] => 
                    [11] => node/add/feed-item
                    [12] => Array
                    [13] => check_plain
                    [14] => 
                    [15] => 6
                    [16] => 
                    [17] => Array
                        (
                            [0] => This content type is being used for automatically aggregated content from feeds.
                            [1] => This content type is being used for automatically aggregated content from feeds.
                        )

                    [18] => 
                    [19] => 0
                    [20] => modules/node/node.pages.inc
                )

        )

georgedamonkey’s picture

Same here. Copied directory over, ran update.php, and I now get that error.

bleen’s picture

i tried this update again on second site and still had the same issue ...

I did a bit more digging and I have a bit more info, but nothing too useful. Basically, I can now confirm that these errors are specifically happening when the menu cache is cleared.

Any more thoughts on this? Anyone?

alex_b’s picture

Status: Postponed (maintainer needs more info) » Active

What's really baffling is that array that contains an array with two equal strings "This content type is being used for automatically aggregated content from feeds." where it should contain a single string of that value. Reviewing feeds_news_node_info() I see that the string is not specified as array though.

I don't really have an idea right now why this happens, but I have seen this error before. Thanks for digging up the debug backtrace.

Marko B’s picture

warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in mysite\includes\database.mysqli.inc on line 323.

having same problem, happens when i hit FLUSH all cache.

Jon Nunan’s picture

Having a look around the code feeds_news and feeds_defaults both use hook_node_info and they both define the same node types; 'feed' & 'feed_item'. It seems that because module_invoke_all uses array_merge_recursive you get some fields added twice which in turn get converted to arrays.

I'm testing out adding a check to feed_news_node_info to see if feeds_default is enabled. If it is, it won't re-define the same nodes. eg.

function feeds_news_node_info() {
  if(!module_exists('feeds_defaults')) {
    //existing code
  }
}
alex_b’s picture

You shouldn't have a feeds_defaults module in your feeds/ tree. Have you cleanly replaced feeds when upgrading or unpacked feeds over the existing directory?

Marko B’s picture

I also had some much more problems with feeds until i deleted feeeds directory and put new one, in most cases you can overwrite but sometimes it makes thinks not work.

alex_b’s picture

in most cases you can overwrite

No module will have a provision for an old file sticking around. Always remove the previous project directory and replace it with a fresh one, never unpack over an existing.

Jon Nunan’s picture

@alex_b: ah that'd be it. Sorry, got a bit lazy. I usually do delete/replace, but cut some corners because I was just upgrading from an earlier beta.

Thanks!

Marko B’s picture

Alex i ment it will work im most cases as it does but i dont recommend such practice :-)

alex_b’s picture

Status: Active » Fixed

#14: Cool - I'll regard this issue as fixed now.

hampshire’s picture

warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in .../includes/database.mysqli.inc on line 323.

I have this problem as well but I am on a fresh install so no upgrades yet. I get this error when I hit "Import" and only when GUID is set in my XPath mapper. IF I remove the xpathparser -> GUID I nolonger get the error.

hampshire’s picture

Status: Fixed » Active
iantresman’s picture

I removed and uninstalled my old Feeds 6.x-1.0 beta 5 (on Drupal 6.16), and then installed the latest beta 9. On enabling Feeds News 6.x-1.0-beta9, the top of the modules admin screen shows (seven times!):

warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/www.mydomain.com/public_html/includes/database.mysqli.inc on line 323.

Danny_Joris’s picture

Same issue. I also had an xmlsitemap error, but now I disabled that there's only this error left:

    * warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/example/public_html/includes/database.mysqli.inc on line 323.
    * warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /home/example/public_html/includes/database.mysqli.inc on line 323.
    * warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/example/public_html/includes/bootstrap.inc on line 857.

I'm trying to import from a Flickr api xml feed. I'm using the Feeds XPath parser for this.

I'm using these queries to get the id and title attribute values from the 'photo' tag: photo/@id and photo/@title

Danny_Joris’s picture

Version: 6.x-1.0-beta5 » 6.x-1.0-beta10

It results in making only one node without a title. The only filled out is the Flickr ID.

alex_b’s picture

Project: Feeds » Feeds XPath Parser
Version: 6.x-1.0-beta10 » 6.x-1.x-dev

Looks like an XPath parser problem to me...

twistor’s picture

@Danny_Joris

Could you post your context and a sample of the xml?

Also, this problem shows up sometime when the query returns multiple values for a field expecting a single value. If you could, try changing your queries to, "photo/@id[1]", "photo/@title[1]" and see if that helps.

Danny_Joris’s picture

FileSize
73.19 KB
13.56 KB

@Chris

Feed settings and sample of the xml in attachment.

I also tried adding [1], but that didn't work.

twistor’s picture

Assigned: Unassigned » twistor

Are you still having this problem? Sorry for the long time between responses.

squinternata’s picture

I have the same problem with dev i have a simple xml and i m importing in nodes but it doesn t fill the title and the body..only a text field..
the xml is
<?xml version="1.0" encoding="ISO-8859-1"?>


Harry Potter

29.99


Learning XML

39.95

in the feed i put
in Context: *

//book

in field_test:
//title

in title:
//title
in body:
//price
and i get two nodes but both wiht only the field_text filled with the first title in book
could you help me please?

squinternata’s picture

sorry i get also this error
in import

* warning: mb_strlen() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/unicode.inc on line 410.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/database.mysql.inc on line 321.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/database.mysql.inc on line 321.
* warning: mb_strlen() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/unicode.inc on line 410.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/database.mysql.inc on line 321.
* warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /opt/lampp/htdocs/TestDrupal/includes/database.mysql.inc on line 321.

joris_lucius’s picture

I also had the problem with

mysqli_real_escape_string() expects parameter 2 to be string, array given in /Applications/MAMP/htdocs/xpath/includes/database.mysqli.inc on line 330.

I disabled all these modules, cleared cache and disabled-> enabled feeds modules.
After that, I got this error no more:
+ Context
+ Features
+ Pathauto
+ Statistics
+ All FeedAPI modules

EDIT:
When tried to map the title field, I got the error back.
And got the problem: only one node is created, without a title.
One field in this one node is mapped and thus filled.

While in my debug-message, I can see all field scraped ok.
I'm using the XPath HTML parserr,
The XPath XML parser works fine on another system.

in addition, when switching on 'show error messages' i got:

There was an error with the XPath query: //html/body/div/div/div[3]/div[2]/div/div.
Libxml returned the message: htmlParseCharRef: missing semicolumn, with the error code: 7.

Feeds 6.x-1.0-beta10

twistor’s picture

Status: Active » Postponed (maintainer needs more info)

Can I have your XML/HTML that you're trying to parse, the XPath queries and context, and the fields you're mapping to? Thanks.

timoguic’s picture

Hi,

I have the same problem on my installation.
Feeds 6.x-1.0-beta10
Feeds XPath Parser 6.x-1.11 (using Xpath HTML in this case)

HTML looks like this:

<html>[...]<body>[...]
<div class="class-organization">
 <h2 id="title">Title</h2>
 <div id="intro">
  <div class="ezxmltext">
   <p>Blah</p>
  </div>
 </div>
 <div id="full">
  <div class="ezxmltext">
   <p>Blah 2</p>
   <p>Blah 3</p>
  </div>
 </div>
</div>
[...]</body></html>
  • My context: //div[@class='class-organization']
  • Title mapped to: h2[@id='title']
  • Body mapped to: //div[@class='ezxmltext']/p

Show debug says:

# There was an error with the XPath query: //div[@class='class-organization'].
Libxml returned the message: Attribute href redefined, with the error code: 42.
# warning: mb_strlen() expects parameter 1 to be string, array given in /xxx/drupal-6.20/includes/unicode.inc on line 410.
# warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /xxx/drupal-6.20/includes/database.mysqli.inc on line 330.

The body of the created node is empty, however I can see that the Xpath expressions are run correctly (in the show debug) - although the Xpath expression for the body returns several elements (as expected).

When I change the expression so that it only returns one element (for instance: //div[@class='intro']) everything works fine. I tried to flush the caches, uninstall Feeds and Feeds Xpath and reinstall etc, without any luck - so I am tempted to think it's related to this issue.

Any ideas?

Marko B’s picture

@timoguic Can you post link you are trying to parse? I am also having some similar problems here.+

http://drupal.org/node/1044546

timoguic’s picture

@deepM: http://bit.ly/hEtb1K
I have to try again on a fresh Drupal install - did not have time to make tests since my last post...

criz’s picture

Status: Postponed (maintainer needs more info) » Active

can't get this module working after upgrade too, getting exactly the same errors. xpaths are working...

Jason Dean’s picture

I'm getting the same thing, using clean install of Feeds 6.x-1.0-beta10 and Feeds XPath Parser 6.x-1.11

My XML:

<?xml version="1.0" encoding="UTF-8"?>
<shows>
	<Show Code="2000" Name="Count Dracula" HomePage="" Spicture="/dracula.jpg">
		<Event Code="6492" VenueCode="1" Date="2011-02-27 19:30:00" StartSaleDate="2010-07-20 10:00:00" EndSaleDate="2011-02-27 19:00:00" />
		<Event Code="6491" VenueCode="1" Date="2011-02-26 20:00:00" StartSaleDate="2010-07-20 10:00:00" EndSaleDate="2011-02-26 19:00:00" />
	</Show>
	<Show Code="2014" Name="David Smith" HomePage="" ShortDesc="" LongDesc="" Spicture="/Smith.jpg">
		<Event Code="6534" VenueCode="2" Date="2011-02-26 19:30:00" StartSaleDate="2010-12-01 10:00:00" EndSaleDate="2011-02-26 19:30:00" />
		<Event Code="6537" VenueCode="2" Date="2011-02-26 14:30:00" StartSaleDate="2010-12-01 10:00:00" EndSaleDate="2011-02-26 14:30:00" />
	</Show>
</shows>

Context: //Show
title field mapping: //@Name[1]

Import creates 2 nodes but they don't have titles. The debug output looks fine, but it's followed by this error repeated 4 times:

warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/jason/webdev/drupal6/includes/database.mysql.inc on line 330.

Interestingly, I don't get any "There was an error with the XPath query..." message as mentioned by others.

Jason Dean’s picture

Sorry - I was being stupid.

The parser was trying to force an array (containing both Show titles) into the title field, and of course Drupal didn't like that. But this was because my XPath expressions were all wrong. They should be:

context: //Show
title field: @Name

Now working fine :)

JGReidy’s picture

For what it's worth I was having the same problem after update to Feeds 6.x-1.0-beta10, but I was using the Common syndication parser, not XPath Parser.
I copied down my feed and mapping info, disabled and uninstalled Feeds, re-enabled it, recreated my feed and the problem went away.

twistor’s picture

Status: Active » Closed (won't fix)

This problem seems to show up when the query returns multiple values for a field expecting a single value. This issue is getting a bit crowded. If anyone is still having this problem, please open another issue.