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

sun - February 8, 2008 - 19:06
Status:active» patch (code needs work)

#2

samtaylor - March 12, 2008 - 23:33
Version:5.x-1.1» 6.x-1.0
Priority:normal» critical

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

andyt - March 19, 2008 - 02:15

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

owen32 - March 25, 2008 - 21:15

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

sun - April 16, 2008 - 21:07
Title:MYSQLi with Joutnal» MySQLi with Journal
Assigned to:Nessiah» Anonymous

Could someone of you please roll the necessary changes into a patch? I don't get what needs to be changed actually.

#6

smk-ka - April 16, 2008 - 22:30

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:

<?php
while ($entry = (is_array($journal) ? array_shift($journal) : db_fetch_object($journal))) {
?>

#7

sun - April 19, 2008 - 16:26
Status:patch (code needs work)» patch (code needs review)

Please test one of the attached patches. Please note, both are against latest code in the DRUPAL-5 resp. DRUPAL-6--1 branch.

AttachmentSize
journal-DRUPAL-6--1.mysqli.patch1.33 KB
journal-DRUPAL-5.mysqli.patch1.9 KB

#8

sun - April 19, 2008 - 16:46

Re-rolled patch for D6.

AttachmentSize
journal-DRUPAL-6--1.mysqli.patch1.9 KB

#9

sun - April 30, 2008 - 14:18
Priority:critical» normal

Re-rolled patch for D6. Please test.

AttachmentSize
journal-DRUPAL-6--1.mysqli.patch1.9 KB

#10

okeedoak - May 3, 2008 - 05:47

Patch from #7, journal-DRUPAL-5.mysqli.patch, fixes problem with D5 version. Thanks!

#11

sun - May 3, 2008 - 16:11
Status:patch (code needs review)» fixed

Thanks, committed.

#12

Anonymous (not verified) - May 17, 2008 - 16:21
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.