Warning: array_keys(): The first argument should be an array

Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!

Warning: array_keys(): The first argument should be an array

Postby Yarbronzebeard » Mon Sep 25, 2006 9:14 pm

Warning: array_keys(): The first argument should be an array in /home/content/y/a/r/yarbronze/html/roster/lib/wowdb.php on line 845

Warning: Invalid argument supplied for foreach() in /home/content/y/a/r/yarbronze/html/roster/lib/wowdb.php on line 845

Warning: array_keys(): The first argument should be an array in /home/content/y/a/r/yarbronze/html/roster/lib/wowdb.php on line 845

Warning: Invalid argument supplied for foreach() in /home/content/y/a/r/yarbronze/html/roster/lib/wowdb.php on line 845

I am getting this error whenever I upload. Been running the roster just fine (1.7.0) and it just recently started doing this, I think after I downloaded the most recent CharacterProfiler.
Yarbronzebeard
WR.net Apprentice
WR.net Apprentice
 
Posts: 1
Joined: Fri Jul 21, 2006 2:46 am

Warning: array_keys(): The first argument should be an array

Postby PleegWat » Mon Sep 25, 2006 9:17 pm

Looks like it's caused by uploading with an empty bag. I'll add a check for 1.7.1
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Warning: array_keys(): The first argument should be an a

Postby lesablier » Mon Sep 25, 2006 9:45 pm

Hello.

Think i've got same problem.
http://guilde.le.sablier.free.fr/roster/index.php
The roster local is frFR
I've update Character profiler 1.6.1 to 1.6.3 (with cp /purge all).
When i'm manually uploading character.lua on roster, i'm getting this
error (but the character is well updating)

Warning: array_keys() [function.array-keys]: The first argument should be an array in /mnt/133/sdb/5/b/guilde.le.sablier/roster/lib/wowdb.php on line 847

Warning: Invalid argument supplied for foreach() in /mnt/133/sdb/5/b/guilde.le.sablier/roster/lib/wowdb.php on line 847


Here is the code on line 847 :
Code: Select all
foreach( array_keys$bag['Contents'] ) as $slot_name )
 


And i've post the character.lua, the sql.log and update.log.

Hopes this helps to debug
Attachments
update_log.txt
(490 Bytes) Downloaded 287 times
sql_log.txt
(138.07 KiB) Downloaded 327 times
characterprofiler.lua
(147.12 KiB) Downloaded 297 times
lesablier
WR.net Journeyman
WR.net Journeyman
 
Posts: 77
Joined: Sat Jul 15, 2006 4:01 pm

Warning: array_keys(): The first argument should be an array

Postby PleegWat » Mon Sep 25, 2006 10:00 pm

Yup, as I suspected. Empty bags. try this:

lib/wowdb.php, line 924. This code block:

Code: Select all
                foreach( array_keys$bag['Contents'] ) as $slot_name )
                {
                    
$slot $bag['Contents'][$slot_name];
                    
$item $this->make_item$slot$memberId$bag_name$slot_name );
                    
$this->insert_item$item,$data['Locale'] );
                } 


Replace with this (insert surrounding IF block)

Code: Select all
                if (isset($bag['Contents']) && is_array($bag['Contents']))
                {
                    foreach( 
array_keys$bag['Contents'] ) as $slot_name )
                    {
                        
$slot $bag['Contents'][$slot_name];
                        
$item $this->make_item$slot$memberId$bag_name$slot_name );
                        
$this->insert_item$item,$data['Locale'] );
                    }
                } 


The same fix should be applied to the bank processing, at line 1019:

Code: Select all
                    foreach( array_keys$bag['Contents'] ) as $slot_name )
                    {
                        
$slot $bag['Contents'][$slot_name];
                        
$item $this->make_item$slot$memberId$dbname$slot_name );
                        
$this->insert_item$item,$data['Locale'] );
                    } 


Replace by

Code: Select all
                    if (isset($bag['Contents']) && is_array($bag['Contents']))
                    {
                        foreach( 
array_keys$bag['Contents'] ) as $slot_name )
                        {
                            
$slot $bag['Contents'][$slot_name];
                            
$item $this->make_item$slot$memberId$dbname$slot_name );
                            
$this->insert_item$item,$data['Locale'] );
                        }
                    } 


And please tell me if it works.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Warning: array_keys(): The first argument should be an a

Postby lesablier » Tue Sep 26, 2006 1:23 am

Thank you PleegWat for your patience.

I've made the modifications as you ask me to do, but still got problem.

However, i haven't say that the roster version is 1.7.0 and use the original wowdb.php

And i found this at line 920
Code: Select all
foreach( array_keys$bag['Contents'] ) as $slot_name )
            {
                
$slot $bag['Contents'][$slot_name];
                
$item $this->make_item$slot$memberId'Bank Contents'$slot_name );
                
$this->insert_item$item ); 


As you notice i haven't
Code: Select all
 ['Locale'


Found 3 times this
Code: Select all
foreach( array_keys$bag['Contents'] ) as $slot_name 

but no
Code: Select all
 ['Locale'
at the end of all.

And line 1019 is in the section of
Code: Select all
**
     * 
Handles formating and insertion of rep data
     
*
     * @
param array $data
     
* @param int $memberId
     
*/ 

witch is not in the to the bank processing

Did i've dowload a wrong version of the Wowroster ?
lesablier
WR.net Journeyman
WR.net Journeyman
 
Posts: 77
Joined: Sat Jul 15, 2006 4:01 pm

Warning: array_keys(): The first argument should be an array

Postby PleegWat » Tue Sep 26, 2006 1:42 am

Damn, you're right. I must have been in my 1.7.1 beta folder.

The right blocks are at line 845, 924 and 937. You should surround all 3 with the if statement

Code: Select all
                    if (isset($bag['Contents']) && is_array($bag['Contents']))
                    { 
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Warning: array_keys(): The first argument should be an a

Postby sturmy » Tue Sep 26, 2006 10:36 am

Does work!

I didn't even notice I had the issue as I run UU for uploads. :-P
sturmy
WR.net Expert
WR.net Expert
 
Posts: 160
Joined: Wed Aug 16, 2006 9:07 pm

Re: Warning: array_keys(): The first argument should be an a

Postby lesablier » Tue Sep 26, 2006 10:45 pm

Ok the problem is solved, no display in top of the page

But (always but ? :blackeye: ) i've notice that now i've got some
Update Errors

Here is the log file of update and here the modified code, could i make a mistake ?
Sturmy can you upload your modified wowdb.php, please ?

EDIT: i put something in all my bags, with modifed wowdb.php, got update Errors like the log file uploaded here, and replace wowdb.php with the original one, no errors, so i can confirm the problem is with emtpy bag or bags.

Code: Select all
if (isset($bag['Contents']) && is_array($bag['Contents']))
             {
                foreach( 
array_keys$bag['Contents'] ) as $slot_name )
                {
                    
$slot $bag['Contents'][$slot_name];
                    
$item $this->make_item$slot$memberId$bag_name$slot_name );
                    
$this->insert_item$item );
                }
              } 



Code: Select all
if (isset($bag['Contents']) && is_array($bag['Contents']))
            {
            foreach( 
array_keys$inv ) as $bag_name )
            {
                if (
$bag_name != 'Contents')
                {
                    
$this->setMessage("<li>$bag_name</li>");
                    
$bag $inv[$bag_name];
                    
$dbname 'Bank '.$bag_name;
                    
$item $this->make_item$bag$memberId'bags'$dbname );
            } 



Code: Select all
if (isset($bag['Contents']) && is_array($bag['Contents']))
            {
                    foreach( 
array_keys$bag['Contents'] ) as $slot_name )
                    {
                        
$slot $bag['Contents'][$slot_name];
                        
$item $this->make_item$slot$memberId$dbname$slot_name );
                        
$this->insert_item$item );
             }
                    }
                }
            } 
Attachments
error_log.txt
(2.23 KiB) Downloaded 294 times
Last edited by lesablier on Tue Sep 26, 2006 11:07 pm, edited 1 time in total.
lesablier
WR.net Journeyman
WR.net Journeyman
 
Posts: 77
Joined: Sat Jul 15, 2006 4:01 pm

Warning: array_keys(): The first argument should be an array

Postby PleegWat » Wed Sep 27, 2006 4:10 pm

I've been thinking about this a bit, and those are strange errors. They suggest that the function saving the bank data isn't deleting correctly, and also isn't saving the item parent correctly. But I have no idea why my changes would do that.

I'm keeping the fix out of SVN for now, but can any other dev take a look why this might happen?
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Warning: array_keys(): The first argument should be an a

Postby sturmy » Wed Sep 27, 2006 10:04 pm

Sure. Here's mine.
Attachments
wowdb.zip
(11.74 KiB) Downloaded 299 times
sturmy
WR.net Expert
WR.net Expert
 
Posts: 160
Joined: Wed Aug 16, 2006 9:07 pm

Warning: array_keys(): The first argument should be an array

Postby yamyam » Sat Sep 30, 2006 7:04 pm

Hi all...

im confused now :(

Is this fix working now or not?
Can anyone solve the issue and give us a fix?

Would be great - thanks a lot.

Anyone any ideas?

I need to get rid off this annyoing error messages,
because every day some guildie tells me if we
got any problems with the roster cause of the error messages :(
Last edited by yamyam on Sat Sep 30, 2006 7:06 pm, edited 1 time in total.
yamyam
WR.net Apprentice
WR.net Apprentice
 
Posts: 37
Joined: Sun Jul 16, 2006 4:11 am

Warning: array_keys(): The first argument should be an array

Postby PleegWat » Sat Sep 30, 2006 7:38 pm

I've put my fix in SVN, and it hasn't caused /me/ any problems yet.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Warning: array_keys(): The first argument should be an array

Postby joehail » Sat Sep 30, 2006 7:55 pm

this fix it taking the error offof the top of the page but causing more errors and not updating the baank.
Image
User avatar
joehail
WR.net Journeyman
WR.net Journeyman
 
Posts: 103
Joined: Tue Jul 04, 2006 4:54 pm
Location: Cincinnati, Ohio USA

Re: Warning: array_keys(): The first argument should be an a

Postby Carissma » Thu Oct 05, 2006 2:32 am

Any fix for this yet? I'm getting the same errors.
Carissma
WR.net Apprentice
WR.net Apprentice
 
Posts: 23
Joined: Tue Jul 11, 2006 9:03 pm

Warning: array_keys(): The first argument should be an array

Postby yamyam » Sun Oct 08, 2006 5:41 pm

Still no fix available?

Help please ... thank you.
yamyam
WR.net Apprentice
WR.net Apprentice
 
Posts: 37
Joined: Sun Jul 16, 2006 4:11 am

Next

Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron