Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 09 Jun 2006, 23:03
iafraid iafraid is offline
 
Join Date: Apr 2006
Problem including global.php in my own scripts.

Hi,

Trying to call some vBulletin methods from my own scripts. This is vB 3.5.4 under WinXP localhost w/ Apache 1.3.33 and PHP 5.0.4. I am executing the following inside one of my wrapper class methods:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

...but I'm getting the following fatal errors which bomb out in the require_once of global.php, which bascially is telling me the $vbulletin variable is empty/NULL even though global.php calls init.php and that $vbulletin variable should already be instantiated via the logic in init:

Warning: array_keys() [function.array-keys]: The first argument should be an array in \includes\functions.php on line 3277

Warning: Invalid argument supplied for foreach() in \includes\functions.php on line 3277

Fatal error: Call to a member function query_read() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 2502

Fatal error: Call to a member function unlock_tables() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 4419

Fatal error: Call to a member function unlock_tables() on a non-object in c:\Dev\htdocs\forums\includes\functions.php on line 4419

...what other environment type setup do I need? Everyone else seems to happily do a chdir() and require_once of global.php and everything works from there.

Are there other vBulletin directory assumptions beyond the chdir?

TIA,
- John
Reply With Quote
  #2  
Old 24 Jun 2006, 03:08
iafraid iafraid is offline
 
Join Date: Apr 2006
Hey iafraid, welcome to the forums!

So the problem seems to be that you are trying to neatly encapsulate things into a wrapper class, which global.php (and the called init.php) was never meant to do.

What you need to do is take that require_once of global.php and put it at the header of every PHP page that will ever call these wrapper classes. Some may say that having to do this on the page level instead of a class level is a crock, but I've made some pretty tasty dishes in my crock pot I must say!

Please let us know if you have any more problems, since we're here to help!
Reply With Quote
  #3  
Old 23 Feb 2012, 22:08
Jafo232 Jafo232 is offline
 
Join Date: May 2004
The only reason I am bumping this up is because I have always had this problem and whenever I google a solution, this comes up first; so I figure this will help someone else who is experiencing the same issue:

http://www.lampwrights.com/showthrea...=1069#post1069
__________________
Become a Lampwright today at www.lampwrights.com!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:32.

Layout Options | Width: Wide Color: