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.
Problem/Motivation
Recoverable fatal PHP error upon installation due to wrong usage of Drupal 7 API.
Recoverable fatal error: Argument 2 passed to db_query() must be an array, integer given, called in /var/www/sites/all/modules/fast_404/fast_404.install on line 11 and defined in db_query() (line 2313 of /var/www/includes/database/database.inc).
Proposed resolution
See attached patch.
Remaining tasks
Review changes and commit to master branch on git.
User interface changes
Nope!
API changes
Nope!
Comment | File | Size | Author |
---|---|---|---|
#14 | 1500092-dbtng-enable.patch | 627 bytes | mr.baileys |
#11 | use_db_api_for_db_update-1500092-11.patch | 633 bytes | Fleshgrinder |
#5 | fast_404-use_db_update_for_db_update.patch | 679 bytes | Fleshgrinder |
fast_404-use_db_update_for_db_update.patch | 663 bytes | Fleshgrinder | |
Comments
Comment #1
protools CreditAttribution: protools commentedpatching file fast_404.install
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 22:
Comment #2
protools CreditAttribution: protools commentedComment #3
bensey CreditAttribution: bensey commentedGot the same error also upon install.
This module sounds like it's going to be my web-hosts best friend! Any news on this fix?
Comment #4
skwashd CreditAttribution: skwashd commentedThe function name should be
fast_404_enabled()
. That's what is currently in git - see http://drupalcode.org/project/fast_404.git/blob/refs/heads/7.x-1.x:/fast...Once that is fixed, then this can probably be RTBCd.
Comment #5
Fleshgrinder CreditAttribution: Fleshgrinder commentedNo clue why the name of the function is different in my patch from above. Here’s a new one which hopefully works.
Comment #6
Vacilando CreditAttribution: Vacilando commentedDamn... even #5 gives:
patching file fast_404.install
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 22:
Comment #7
Vacilando CreditAttribution: Vacilando commentedAlthough the patch in #5 does not apply well, after implementing it manually fast_404 installs without a hitch.
Comment #8
Fleshgrinder CreditAttribution: Fleshgrinder commentedI have no clue why this error occurs.
Line 22 is
+ ->condition('type', 'module')
and this looks okay to me.Comment #9
kingfisher64 CreditAttribution: kingfisher64 commentedCan we have the patch in #5 released in a new dev version?
Comment #10
kingfisher64 CreditAttribution: kingfisher64 commentedCan't use this mod until this issue is fixed. Can someone who knows how to apply the fix either zip the fixed version here or update dev version?
Comment #11
Fleshgrinder CreditAttribution: Fleshgrinder commentedHere’s a patch for the development branch of Fast 404. Hope this patch works as expected this time.
Also changed the version of this issue to the development branch as it applies to any Fast 404 version for Drupal 7.
Comment #12
kpearl CreditAttribution: kpearl commentedTested this patch on a clean install that has fast 404 enabled still have this error.
Comment #13
kpearl CreditAttribution: kpearl commentedSorry I figured out that I was getting an error on an environment that I didn't apply the patch too. My apologies! The patch does work.
Comment #14
mr.baileysRe-rolled the patch since:
git apply
andpatch
both complained about the patch being malformed;7.x-1.x-dev
, which seems to be a dead-end branch (all versions > 7.x-1.1 have been tagged on branch7.x-1.x
. This is also the reason for the "light_not_found_enabled()
"-function name instead of "fast_404_enabled()
". Patch here is rolled based on the latter.Comment #15
mr.baileysMarked #1841160: Recoverable fatal error on install en #1650714: Fatal error @ module enable - "Cannot use a scalar value as an array database.inc" as duplicate.
Comment #16
warmth CreditAttribution: warmth commentedRecoverable fatal error: Argument 2 passed to db_query() must be an array, integer given, called in /home/MYSITE/www/SUBFOLDER/sites/all/modules/fast_404/fast_404.install on line 11 and defined en db_query() (línea 2313 de /home/MYSITE/www/SUBFOLDER/includes/database/database.inc).
Could this be related to Advanced CSS/JS Aggregation fast 404s function or they are safe to work together?
#14 worked for me at least to install/enable the module
Comment #17
batje CreditAttribution: batje commentedpatch #14 looks good and works
Comment #18
soyarma CreditAttribution: soyarma commentedCommitted to master, will cut a tag once I get some other bugfixes in.
Comment #19
soyarma CreditAttribution: soyarma commentedCode pushed, will be in dev branch tonight and upcoming new release
Comment #20
rootworkAny chance we could get that new release soon?
Comment #21
webservant316 CreditAttribution: webservant316 commentedwhen is dev going to be released to the next version?
Comment #22
Scott Robertson CreditAttribution: Scott Robertson commentedThis is still an issue in 7.x-1.3, even though it was committed and marked as fixed over a year ago. Is there any ETA on when we might see the next 7.x release?
Comment #23
jdflorez CreditAttribution: jdflorez commentedI also got the error today when installing it on a D7.22 site with commerce kickstart (7.x-2.6). Can the fix be pushed to a new stable release?
Comment #24
WebWalker3D CreditAttribution: WebWalker3D commentedAlso getting this issue with latest STABLE release. How can this be a stable release if it can't even install? D7.31 using 7.x-1.3. Fixing this would seem to be a critical issue.
Comment #25
heatherwoz CreditAttribution: heatherwoz commentedWas very excited to try this module and I too received the fatal error upon install. Very frustrating.
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedHi
I have the same error but at diferent line on database.inc (I have Drupal 7.31)
Comment #27
Agileware CreditAttribution: Agileware commentedReceiving this error on a STABLE release does not bode well for new users. Recommend that a new release be issued which is stable or pull the current "stable" release as it's only stable once patched.
Comment #28
jlnd CreditAttribution: jlnd commentedSame problem here with fast_404-7.x-1.3.tar on Drupal 7.31.
Comment #29
kevinquillen CreditAttribution: kevinquillen commentedConfirmed. Fresh install got the same error.
Seems like the query should be:
But db_update should be used as illustrated above.
Comment #30
adammaloneHello, looks like the dev branch has had the code that fixes this issue in for a while. I've cut a new tag for the code that's been in the dev branch for about a year. Watch for the release.