MySQLi with Journal
Nessiah - February 8, 2008 - 10:32
| Project: | Journal |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Line 207 with MYSQLi give error at me:
warning: array_shift() [function.array-shift]: The argument should be an array in /var/www/html/drupal/sites/all/modules/journal/journal.module
change Line to
while ($entry = ( is_object($journal) ? db_fetch_object($journal) : array_shift($journal))) {
works fine now

#1
#2
I'm getting a similar error but in line 203; that code fixed it. This needs to be updated!
EDIT: I'm also getting these errors when writing a page:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /nfsn/content/flaglerama/public/modules/journal/journal.module on line 72.
warning: array_unshift() [function.array-unshift]: The first argument should be an array in /nfsn/content/flaglerama/public/modules/journal/journal.module on line 85.
I don't know PHP but will try to hack out a fix for these if this doesn't get updated before then.
#3
Installation of 6.1 with Journal 6.x-1.0 (release date 2008-Feb-13) gave the same error for line 203. The fix worked.
I have not seen any other errors.
#4
journal-6.x-1.0.tar.gz
Same Errors:
warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\webs\North\modules\journal\journal.module on line 72.
warning: array_unshift() [function.array-unshift]: The first argument should be an array in C:\webs\North\modules\journal\journal.module on line 85.
Drupal 6.1
win2k3 R2 with all SPs and fixes
MySQL Server 5.0.11
PHP Version 5.2.5
Microsoft-IIS/6.0
#5
Could someone of you please roll the necessary changes into a patch? I don't get what needs to be changed actually.
#6
For some reason MySQLi seems to not return a resource anymore but an object. However, the proposed fix surely breaks legacy MySQL, because that'll still return a resource. A patch working for both worlds could look like this:
<?phpwhile ($entry = (is_array($journal) ? array_shift($journal) : db_fetch_object($journal))) {
?>
#7
Please test one of the attached patches. Please note, both are against latest code in the DRUPAL-5 resp. DRUPAL-6--1 branch.
#8
Re-rolled patch for D6.
#9
Re-rolled patch for D6. Please test.
#10
Patch from #7, journal-DRUPAL-5.mysqli.patch, fixes problem with D5 version. Thanks!
#11
Thanks, committed.
#12
Automatically closed -- issue fixed for two weeks with no activity.