Closed (fixed)
Project:
Discogs
Version:
6.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
28 Feb 2011 at 16:34 UTC
Updated:
25 Jan 2012 at 01:30 UTC
Jump to comment: Most recent file
I get the following error everytime I import an album from discogs. Please note the import is successful, but the error happens every time.
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in [path]/htdocs/includes/database.mysql.inc on line 330.
E.g.
Discogs.com import
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /usr/local/pem/vhosts/169594/webspace/siteapps/120590/htdocs/includes/database.mysql.inc on line 330.
Discography release Vimana has been created.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | Issue-1076214-by-Karlheinz-Fixed-error-when-importin.patch | 4.66 KB | Karlheinz |
| #11 | Discogs-Issue-1076214-by-Karlheinz-Fixed-hopefully-error-whe.patch | 13.56 KB | Karlheinz |
| #7 | modules.txt | 2.49 KB | strawberrybrick |
Comments
Comment #1
strawberrybrick commentedComment #2
strawberrybrick commentedactually using beta1
Comment #3
Karlheinz commentedI don't know why Drupal isn't auto-generating the -dev (HEAD) version... I assumed it had something to do with the Git migration, but now I'm not sure...
In any case, that's an odd error. I've never run across it before. It sounds like Discogs is passing Drupal an array for something like artist or title or something.
Which album were you importing? It might help me track that bug down.
Also, is this with every album, or just one or two?
Comment #4
strawberrybrick commented/every/ album I import.
fwiw, I tried importing the album on another installation of drupal, same error:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in [path]drupal/includes/database.mysqli.inc on line 330.
Comment #5
Karlheinz commentedDammit. OK, I'll take a look at it. Hopefully I should have a patch later today.
That's a pretty serious issue, so I changed the priority to "major."
Comment #6
Karlheinz commentedI cannot for the life of me recreate this bug. The errors are happening in
db_escape_string(), but I'm not calling that function in my code. I'm sure it happens somewhere when Drupal writes data to the database... but the API page doesn't have the call hierarchy, so I can't follow it back to where it's going wrong.I'm going to need a lot more info from you, I'm afraid.
Any clues you can give me would be helpful. Frankly, I'm stumped.
Comment #7
strawberrybrick commented- What image handler are you using?
ImageAPI GD2
- Does this happen only when importing albums, or also when you create albums by hand?
Manual creation has NO errors. This error is only when importing albums.
- When did you first start getting the error?
Since I installed the discogs module.
- Have you applied any of the patches from this issue queue?
No.
- What other modules are installed? Activated?
See attached.
- I'd like any info you can give me about the environment - exact Drupal version, OS of the webserver, etc.
Drupal core 6.20
MySQL database 5.0.83
PHP 5.2.9
Comment #8
Karlheinz commentedI'm betting that this issue is related to #1152738: label, catalog field import issue. Funny that I never ran across it before, though.
Details are in that issue... I'm not entirely sure it's the same cause, though. I'll try to fix that issue, and we'll see if it fixes this one as well. If it does, I'll mark this one as a duplicate.
Comment #9
Karlheinz commentedI fixed the other issue, #1152738: label, catalog field import issue. The fix is in HEAD, and there's a patch in the other thread. I believe, but don't know for sure, that it should fix this issue as well.
Can you test and confirm? I was never able to replicate this bug.
Comment #10
strawberrybrick commentedUsing 6.x-1.x-dev, here's the errors:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /var/www/drupal/includes/database.mysqli.inc on line 329.
warning: trim() expects parameter 1 to be string, array given in /var/www/drupal/sites/all/modules/date/date/date_token.inc on line 40.
Comment #11
Karlheinz commentedI still can't replicate this bug at all, so I'm kind of in the dark here.
The only thing I can think of is a change to _discogs_trim. I added code to make sure the string was actually a string and not an array.
I just pushed it to 6.x-1.x-dev, but it probably won't show up here for a while (patches can take 24 hours to propagate). In the meantime, I've provided a patch.
Still, I'm not entirely convinced this is the problem, as this function is mostly called when you're adding a release by hand. The only other place I could see this happening is in theme_discogs_forminfo, which uses check_plain and check_markup. However, I have code there to double-check that those are not arrays.
If that's where it was happening, the error would occur whenever you're seeing a checkbox-list of the albums, artists, etc. to import. Is that where it's occurring?
Comment #12
strawberrybrick commentedSwitched to "master" with git, and was able to apply the patch successfully. However, still have the following (non-fatal) warning when importing releases:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in /var/www/drupal/includes/database.mysqli.inc on line 329.
warning: trim() expects parameter 1 to be string, array given in /var/www/drupal/sites/all/modules/date/date/date_token.inc on line 40.
Note that second warning is new with beta2 and the patch, so I would guess trim doesn't help matters.
Comment #13
Karlheinz commentedOkay, I did some work on the two functions that I suspect were causing problems. I've included a patch. Please test this and see if it works.
I also changed the function to trim fields to length. If anything is different now because of that, please let me know. It shouldn't be, so if there is something different, that might be a clue as to why it's throwing those errors.
Comment #14
Karlheinz commentedAfter re-writing for Discogs API v.2, I'm closing this issue as fixed. Re-open if it happens again.