Errors with storybl...
 
Notifications
Clear all

Errors with storyblock.php

11 Posts
3 Users
0 Reactions
2,367 Views
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

URL to your eFiction: efictiontest.verilyviridian.com
Version of eFiction: 3.5
Have you bridged eFiction, if so with what?: No
Version of PHP: 5.2.6
Version of MySQL: 5.0.51-community
Have you searched for your problem: Yes
If so, what terms did you try: storyblock, error (various combos)
State the nature of your problem:

When I view certain pages, I see errors.  Debugging is off.
URLs in question:
http://efictiontest.verilyviridian.com/browse.php?type=titles
http://efictiontest.verilyviridian.com/browse.php?type=categories&catid=1
http://efictiontest.verilyviridian.com/user.php?action=favst
Possibly others

Error:

Warning: array_keys() [function.array-keys]: The first argument should be an array in /public_html/efictiontest/includes/storyblock.php on line 89

Warning: implode() [function.implode]: Bad arguments. in /public_html/efictiontest/includes/storyblock.php on line 89

However, adding favorites is working fine.  I'd like to get rid of the messages, preferably by correcting the problem, but I'm not too picky.

Do you have a test account for us? Yes, PM for details (was recently hacked, unsure how)


 
Posted : 31/10/2008 6:18 pm
(@babaca)
Posts: 722
Member Moderator
 

I clicked all your links and didn't see the error message at all, but opening up storyblock.php and looking at it line 89 seems to be about whether a story is completed or not. When looked at your links again the stories seemed to be set to yes or no for completed, so I'm not sure what's going on. Were you using Tammy's mod Story End?


******************************************
Mucking around in eFiction since circa 2001 (ver. 1.0)
Now running v.3

 
Posted : 02/11/2008 12:34 am
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

There are no mods to this version.  The yes/no completed is part of the standard install and I haven't added anything to it.

It turns out the errors only show up when I'm logged in as an admin.  When I'm logged in to my test account (non-admin), I get the following additional error:

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/veril3/public_html/efictiontest/includes/storyblock.php on line 121


 
Posted : 02/11/2008 2:28 pm
(@tammy)
Posts: 2577
Member Moderator
 

I think your co-authors didn't get converted correctly when you updated.


 
Posted : 04/11/2008 2:20 pm
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

Sorry I haven't been by, this week has been awesome.

That's a distinct possibility.  For some reason none of the database changes actually happened, and I attempted to run update.php again and it told me it was already done.  Anyway, I did them manually, but I evidently missed something.  I'll look into it, thanks!


 
Posted : 09/11/2008 5:11 pm
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

Okay, so, my coauthors table looks good now.  I had created it manually and the index was not right, but I've fixed it and the problem persists.  I actually went through update.php and verified all the database changes and everything should be exactly right. (Of course I could have overlooked something.)

Anyone have any other thoughts?

Lines 89 of storyblock.php, for reference:

$tpl->assign("addtofaves", "[<a href="""._BASEDIR."user.php?action=favst&amp;add=1&amp;sid=".$stories['sid'"]."">"._ADDSTORY2FAVES."</a>] [<a href="""._BASEDIR."user.php?action=favau&amp;add=".$stories['uid'"].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."">"._ADDAUTHOR2FAVES."</a>]");


 
Posted : 08/12/2008 7:34 pm
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

I have updated this site to 3.5.1 and the problem persists.  It's been happening ever since I've upgraded to 3.5.  The messages are only appearing when I am logged in. It only appears at all when logged in, I think because line 89 references adding stuff to faves.

I have another site with identical modifications and modules, except that it has PHP 4 and it's at version 3.4.3.  It doesn't have this issue.

Erm, what else.  I have a test account.  Username is Testytest and password is Tester. Actually, there's an additional message when logged in as non-admin.

Warning: array_keys() [function.array-keys]: The first argument should be an array in /public_html/efictiontest/includes/storyblock.php on line 89

Warning: implode() [function.implode]: Invalid arguments passed in /public_html/efictiontest/includes/storyblock.php on line 89

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /public_html/efictiontest/includes/storyblock.php on line 121

This new third one references a line that would cause adminlinks to display: note, this only appears when logged in as a regular member.

Line 89:


$tpl->assign("addtofaves", "[<a href="""._BASEDIR."user.php?action=favst&amp;add=1&amp;sid=".$stories['sid'"]."">"._ADDSTORY2FAVES."</a>] [<a href="""._BASEDIR."user.php?action=favau&amp;add=".$stories['uid'"].(count($stories['coauthors']) ? ",".implode(",", array_keys($stories['coauthors'])) : "")."">"._ADDAUTHOR2FAVES."</a>]");

Line 121:


else if(isMEMBER && (USERUID == $stories['uid'] || array_key_exists(USERUID, $stories['coauthors']))) $tpl->assign("adminlinks", "<div class="adminoptions"><span class='label'>"._OPTIONS.":</span> ".$adminlinks."</div>");

Incidentally, I have a brand-new install of 3.5.1 with the same settings and modifications (although no modules yet), and the same PHP and MySQL as my 3.4.3 site (dracoandginny.com, in my sig), and it does not have this issue whatsoever.  Maybe it's because of PHP 5?

One more thing: it seems to be only happening when it is displaying stories that have coauthors as part of the list.


 
Posted : 16/04/2009 6:03 pm
(@tammy)
Posts: 2577
Member Moderator
 

As I said, I think one of your updates didn't complete correctly and therefore your coauthors information is set wrong.


 
Posted : 16/04/2009 8:45 pm
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

I have checked the database against what appears in the files and everything matched up.  I'll check again.  I might have missed something.


 
Posted : 16/04/2009 8:47 pm
(@lyndsie)
Posts: 1263
Member Moderator
Topic starter
 

Okay, I've fixed it.  I actually caught a lot of small changes (mostly defaults) that were missed over the course of time in my database, so that was good.

The coauthors field in the fanfiction_stories table was set to null and had some default other than 0 in there.  Also, this apparently hadn't run.


dbquery("UPDATE ".TABLEPREFIX."fanfiction_stories SET coauthors = '1' WHERE coauthors != '0'");

There was a 3 in there, and a bunch of 1s even though there were no coauthors, because I hadn't realized that field also existed, and at least in the 3.5 version, the field wasn't being zeroed out when the coauthors removed.  (Neither were the proper fields in fanfiction_coauthors being deleted.)  There's nowhere else I have to modify things for coauthors upon removal, is there?


 
Posted : 16/04/2009 11:12 pm
(@tammy)
Posts: 2577
Member Moderator
 

Now that they're set to 1 or 0 you shouldn't.


 
Posted : 17/04/2009 12:25 pm
Share: