Log in

View Full Version : Problems after going from PHP4 to PHP5


subnet_rx
09-04-2007, 04:31 AM
I'm getting a weird error after upgrading to PHP 5.2. It is most likely an addon, but it's tough to tell which one.


Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /includes/functions.php(1259) : eval()'d code on line 3

Opserty
09-04-2007, 08:49 AM
Go to your functions.php file and see what is on line 1269. It should be something like ...fetch_hook('XXX')...

XXX is the hook location which you can then look for in your Plugin Manager to find which one is causing the problem. I don't know what version your running but I wasn't able to find something in my vB files, although yours may be different. The closest I found was fetch_userinfo, so it may be worth checking it out.

Dean C
09-04-2007, 09:04 AM
To fix it, cast the array in array_merge using (array)$array or whatever the variable is. I'm assuming you have programming experience, if not then post up the code and someone will tell you what you need to do :)

Eikinskjaldi
09-04-2007, 11:10 AM
I've had errors from php 5.2.3, including the dreaded bus error, thread has crashed.

I would be wary about 5.2

Paul M
09-04-2007, 11:28 AM
vb.org (and vb.com) run on php 5.2.3, as do other forums I look after, none have had any issues.

subnet_rx
09-04-2007, 01:04 PM
Ok, here may be the bigger problem. I disabled all hooks before doing this upgrade, but after logging back in, I enabled them to see if anything would go wrong. It did. This error prevents me from getting the plugin display. I'm going to have to track these down in the database to fix them. I'm actually unsure where the location of the hook is. user_info is close, but not on line 1259. I did a search in the plugins table and it came up with 20 rows that have array_merge. Would it be ok to cast all of them?

Opserty
09-04-2007, 01:27 PM
Adding define('DISABLE_HOOKS', true); to your config.php (either at the very bottom or just under the opening <?php tag) should enable you to access the plugin page and prevent the error from appearing until you have figured it out what is wrong.

subnet_rx
09-04-2007, 04:06 PM
Adding define('DISABLE_HOOKS', true); to your config.php (either at the very bottom or just under the opening <?php tag) should enable you to access the plugin page and prevent the error from appearing until you have figured it out what is wrong.

thanks for that tip.

Ok, I did a search in the plugins table and got 20 plugins that use array_merge. I cast the first variable in all of them as an array. Same error. Is there no better way to figure out what is being eval'd on line 1259?

Paul M
09-04-2007, 06:09 PM
If you followed the previously given advice you would see it's the fetch_userinfo hook, it's not a commonly used hook so I doubt many of you products are using it, just look in the plugin manager to find which one and view the code.

subnet_rx
09-04-2007, 06:59 PM
Yeah, I followed the advice. There are no plugins using that hook. Like I said, I've edited all that the search finds that uses array_merge. It finds an error on 1259, but there is no hook on that line, so that tells me that there is code being included server side giving that file more lines. I need to see it as the server sees it.

EDIT: Nevermind, I was looking for userinfo, not fetch_userinfo. Here's the code causing the problem. It's from the welcome headers addon.


if (THIS_SCRIPT == "index")
{
global $globaltemplates;

$globaltemplates = array_merge((array)$globaltemplates, array('forumhome_welcomepanel_' . $vbulletin->options['wp_style']));
}

Paul M
09-04-2007, 08:25 PM
I would think this is the problem, the bit in red seems to have no business being there.

$globaltemplates = array_merge((array)$globaltemplates, array('forumhome_welcomepanel_' . $vbulletin->options['wp_style']));

Opserty
09-04-2007, 09:01 PM
I would think this is the problem, the bit in red seems to have no business being there.

I think he was attempting to use type casting (as suggested by Dean C)

A better way to do it may be?

if (THIS_SCRIPT == "index")
{
global $globaltemplates;

$globaltemplates[] = 'forumhome_welcomepanel_' . $vbulletin->options['wp_style'];
}

Eikinskjaldi
09-04-2007, 11:19 PM
vb.org (and vb.com) run on php 5.2.3, as do other forums I look after, none have had any issues.


Can you merge posts with inline moderation?

voter
09-06-2007, 11:01 AM
If you followed the previously given advice you would see it's the fetch_userinfo hook, it's not a commonly used hook so I doubt many of you products are using it, just look in the plugin manager to find which one and view the code.

Go to your functions.php file and see what is on line 1269. It should be something like ...fetch_hook('XXX')...

XXX is the hook location which you can then look for in your Plugin Manager to find which one is causing the problem. I don't know what version your running but I wasn't able to find something in my vB files, although yours may be different. The closest I found was fetch_userinfo, so it may be worth checking it out.


Thank you guys for tip. My problem is solved when somebody like to know, it was the vBShout [Template Cache] in my case, that was making problem and using fetch_userinfo.