Search code examples
phpvbulletin

PHP, vBulletin: Fatal error: Call to a member function clean_array_gpc() on a non-object


With vBulletin in PHP, I'm getting this error

Fatal error: Call to a member function clean_array_gpc() on a non-object in C:\inetpub\forum\includes\class_bootstrap.php on line 124

on the following line of code:

    $vbulletin->input->clean_array_gpc('r', array(
        'referrerid' => TYPE_UINT,
        'a'          => TYPE_STR,
        'nojs'       => TYPE_BOOL
    ));

I can appreciate that either $vbulletin or $vbulletin->input hasn't been instantiated yet; but my question goes a bit deeper and is perhaps a bit vBulletin-centric:

  • If not in class_bootstrap.php, where do $vbulletin (which, of course, is global) and $vbulletin->input get instantiated?

Solution

  • This happens in .\includes\class_core.php.

    In my particular installation, it occurs on line 3100 in the vB_Registry() function.

        function vB_Registry()
        {
            {...}
    
            // initialize the input handler
            $this->input = new vB_Input_Cleaner($this);
    
            {...}
         }