PDA

View Full Version : in_array() Turning Up Parse Error


Digital Jedi
01-18-2015, 08:34 AM
I've had these plugins for years, something Lynne showed me a long while back. I'm not sure when they started turning up this parse error on the affected forum, but now the comma is an unexpected ',' and I'm not quite seeing why:

if(in_array($this->forum['forumid'], array(645, 646, 682, 683, 684, 684, 685, 686, 688)) AND $post['postid'] == $this->thread['firstpostid'])
{
$this->templatename = 'postbit_story';
}

It let's you set your own templates for the first post in a thread. It seems to be working fine, still. But, for whatever reason, the forums with the IDs in the array display a parse error with the comma being the culprit. Did something in PHP change that I missed? http://www.cogonline.net/forums/forumdisplay.php?f=773

ozzy47
01-18-2015, 08:38 AM
What version of PHP are you running?

Digital Jedi
01-18-2015, 08:41 AM
5.3.29.

ozzy47
01-18-2015, 08:47 AM
Just for kicks, try this.

if($this->thread['firstpostid'] == $this->post['postid'] AND in_array($this->thread['forumid'], array(645, 646, 682, 683, 684, 684, 685, 686, 688)))

And add this to the top of your plugin.

global $vbulletin;

Digital Jedi
01-18-2015, 08:53 AM
Same error on the same line. Also didn't change the postbit. Confuzzled.

ozzy47
01-18-2015, 08:55 AM
And when you disable the plugin, the error goes away.

Digital Jedi
01-18-2015, 09:03 AM
Geez, it's a completely different plugin. One I started earlier today and didn't finish. Remind me to just stop working on vBulletin at 6 AM.

ozzy47
01-18-2015, 09:05 AM
LOL, it's cool brother, it happens to all of us. :)

Lynne
01-18-2015, 03:24 PM
LOL