Fatal error: Non-static method Glob::Glob() cannot be called

Fatal error: Non-static method Glob::Glob() cannot be called

Postby edub9 on Fri Jan 02, 2009 7:08 pm

When I try to access the Plugin Center or plugin settings in the admin I get the following error message.
What the heck? Please help.

Fatal error: Non-static method Glob::Glob() cannot be called statically, assuming $this from incompatible context in /home/johnhawm/public_html/lifetype_evac/class/plugin/pluginmanager.class.php on line 194

Thanks,

Edub9
www.Edub9.com
edub9
 
Posts: 5
Joined: Fri Jan 02, 2009 7:03 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Sat Jan 03, 2009 3:05 am

What plugins do you have installed? And what versions of those plugins?
My guess is that you have an old plugin installed, perhaps one that hasn't been upgraded to 1.2.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby edub9 on Sat Jan 03, 2009 11:15 am

I am not sure what is causing the problem as I jumped right in and ftp'd all of them directly to my server.
I suppose I will restore the plugins folder to its orig state with no plugins and install one by one. Will keep you posted.

Edub9
edub9
 
Posts: 5
Joined: Fri Jan 02, 2009 7:03 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby edub9 on Sat Jan 03, 2009 12:12 pm

Ok here is my error again.

atal error: Non-static method Glob::Glob() cannot be called statically, assuming $this from incompatible context in /home/johnhawm/public_html/lifetype_evac/class/plugin/pluginmanager.class.php on line 194

And here are the lines 194 thru 196

$pluginFiles = Glob::glob( $this->_pluginDir, "*" );
if( !is_array( $pluginFiles ))
return $pluginList;

And here is the entire pluginmanager.class.php file

I have tried to change "*" to all types of addresses and nothing works?
Should Glob::Glob() be changed to something else?


<?php


lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
lt_include( PLOG_CLASS_PATH."class/misc/glob.class.php" );
// lt_include( PLOG_CLASS_PATH."class/controller/blogcontroller.class.php" );
// lt_include( PLOG_CLASS_PATH."class/controller/admincontroller.class.php" );
lt_include( PLOG_CLASS_PATH."class/plugin/eventlist.properties.php" );
// lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
lt_include( PLOG_CLASS_PATH."class/controller/resourceclassloader.class.php" );

/**
* other various constants
*/
define( "PLUGIN_MANAGER_DEFAULT_PLUGIN_FOLDER", "./plugins/" );
define( "PLUGIN_MANAGER_DEFAULT_PLUGIN_FILE_PATTERN", "plugin*.class.php" );

/**
* \ingroup Plugin
*
* Implements a 'plugin manager' a class that takes care of loading plugins, initializing
* them, allowing plugins to register for certain events, etc.
*
* This class will rarely be called by user classes, since all the plugin initialization and
* delivery of messages is handled by the core classes.
*
* You should not create objects of this class. In case you need a handle to the global
* PluginManager, please use the singlethod getPluginManager as follows:
*
* <pre>
* $pm =& PluginManager::getPluginManager();
* $pm->notifyEvent( ... );
* </pre>
*/
class PluginManager
{

var $_pluginDir;
var $_filePattern;
var $_blogInfo;
var $_userInfo;
var $_pluginInstances;
var $_source;

/**
* global variable to save the list of plugins registered so far
*/
var $_pluginList;

/**
* global variable to save which plugins registered which events
*/
var $_pluginEventList;

/**
* Constructor.
*
* @param pluginDir Specifies from which folders templates should
* be loaded from.
* @param filePattern
*/
function PluginManager( $pluginDir = PLUGIN_MANAGER_DEFAULT_PLUGIN_FOLDER, $filePattern = PLUGIN_MANAGER_DEFAULT_PLUGIN_FILE_PATTERN )
{
$config =& Config::getConfig();

// initialize the arrays used to keep track of plugins and events
$this->_pluginEventList = Array();
$this->_pluginInstances = Array();

$this->_enabled = $config->getValue( "plugin_manager_enabled" );
$this->_pluginDir = $pluginDir;
$this->_filePattern = $filePattern;

$this->_pluginList = $config->getValue( "plugin_list" );
// just in case there is something wrong...
if( $this->_pluginList == "" )
$this->_pluginList = Array();
}

function getPluginList()
{
return( $this->_pluginList );
}

/**
* Sets the blog info
*
* @param blogInfo
*/
function setBlogInfo( &$blogInfo )
{
$this->_blogInfo = $blogInfo;
}

/**
* Sets the user info
*
* @param userInfo
*/
function setUserInfo( &$userInfo )
{
$this->_userInfo = $userInfo;
}

/**
* Returns the current instance of the plugin manager.
*
* @param pluginDir
* @param filePattern
* @see PluginManager
* @return Returns an instance of the PluginManager, so that there is only one plugin
* manager at any given time
*/
function &getPluginManager( $pluginDir = PLUGIN_MANAGER_DEFAULT_PLUGIN_FOLDER, $filePattern = PLUGIN_MANAGER_DEFAULT_PLUGIN_FILE_PATTERN )
{
static $managerInstance;

// check if there was an instance of the Config class already created
if( !isset($managerInstance)) {
// if there wasn't, then create a new one
$managerInstance = new PluginManager( $pluginDir, $filePattern );
}

return $managerInstance;
}

/**
* Returns wether the plugin manager is enabled or not.
*
* @return A boolean value telling wether the plugin manager is enabled or not.
*/
function isEnabled()
{
return $this->_enabled;
}

/**
* returns true if the given plugin has been registered as a such
*
* @param pluginId the identifier of the plugin
* @return Returns true if the plugin is registered or false otherwise
*/
function pluginIsRegistered( $pluginId )
{
return( array_key_exists( $pluginId, $this->_pluginList ));
}

/**
* Checks whether the version reported by the plugin is compatible with the current version of LT
*
* @return True if compatible or false otherwise.
*/
function _pluginCanRun( $version )
{
/**
* :TODO:
*
* to define this!!
*/
return true;
}

/**
* Loads all the plugins from disk
*
* @param source
*/
function loadPlugins( $source = "" )
{
$classLoader =& ResourceClassLoader::getLoader();

$this->_source = $source;

foreach( $this->_pluginList as $plugin ) {
$pluginFile = "./plugins/$plugin";
$classInstance = $this->_createPluginInstance( $plugin );
if( $classInstance ) {
// tell the resource loader that it should try to load actions from this folder
$classLoader->addSearchFolder( PLOG_CLASS_PATH."$pluginFile/class/action/" );
}
}

return true;
}

/**
* refreshes the list of folders from disk
*/
function getPluginListFromFolder()
{
$pluginList = Array();

$pluginFiles = Glob::glob( $this->_pluginDir, "*" );
if( !is_array( $pluginFiles ))
return $pluginList;

foreach( $pluginFiles as $pluginFile ) {
if( File::isDir($pluginFile)) {
// build up the name of the file
$pluginIdElements = explode("/", $pluginFile);
$pluginId = array_pop($pluginIdElements);
$pluginFileName = "plugin".$pluginId.".class.php";
$pluginFullPath = PLOG_CLASS_PATH."$pluginFile/$pluginFileName";
// and try to include it
if( File::isReadable( $pluginFullPath )) {
$pluginList[] = $pluginId;
}
}
}

return $pluginList;
}

/**
* saves the list of plugins to the config backend
*/
function savePluginList( $list )
{
$config =& Config::getConfig();
$config->setValue( "plugin_list", $list );
$config->save();
}

/**
* @private
*
* Given a plugin identifier, creates a new instance of it and returns a reference ot the instance.
* The instance is also saved in the PluginBase::_pluginInstances array
*
* @return Returns a reference to a plugin class extending PluginBase or null if there was an error
*/
function _createPluginInstance( $plugin )
{
// return null by default
$classInstance = null;

$pluginFile = "./plugins/$plugin";
if( File::isDir($pluginFile)) {
// build up the name of the file
$pluginFileName = "plugin{$plugin}.class.php";
$pluginFullPath = PLOG_CLASS_PATH."$pluginFile/$pluginFileName";
// and try to include it
if( File::isReadable( $pluginFile."/".$pluginFileName )) {
$className = "Plugin".$plugin;
lt_include( $pluginFullPath );
$classInstance =& new $className( $this->_source );
$classInstance->setPluginFolder( PLOG_CLASS_PATH.$pluginFile."/" );
$name = $classInstance->getId();

if( $name == "" ) {
throw( new Exception( "Plugin file $pluginFile has no identifier defined!" ));
die();
}

// create an instance only if the plugin is allowed to run in this version of LT
if( $this->_pluginCanRun( $classInstance->getVersion())) {
$this->_pluginInstances["$name"] = &$classInstance;
}
}
}

return( $classInstance );
}

/**
* @private
*/
function refreshPluginList()
{
$this->_pluginList = $this->getPluginListFromFolder();

foreach( $this->_pluginList as $plugin ) {
$classInstance = $this->_createPluginInstance( $plugin );
if( $classInstance ) {
$classInstance->install();
}
}

$this->savePluginList( $this->_pluginList );

return true;
}

/**
* @private
*/
function _loadPluginLocale( $pluginId, $locale )
{
lt_include( PLOG_CLASS_PATH . "class/locale/locales.class.php" );

return( Locales::getPluginLocale( $pluginId, $locale ));
}

/**
* Returns the folder used to store the plugins.
*
* @return The folder used to store the plugins.
*/
function getPluginDir()
{
return $this->_pluginDir;
}

/**
* Returns the array of plugins.
*
* @return An array of PluginBase objects.
*/
function getPlugins()
{
foreach( $this->_pluginList as $name ) {
if( array_key_exists( $name, $this->_pluginInstances ) ) {
$this->_pluginInstances["$name"]->setBlogInfo( $this->_blogInfo );
$this->_pluginInstances["$name"]->setUserInfo( $this->_userInfo );
$this->_pluginInstances["$name"]->register();
}
}

return $this->_pluginInstances;
}

/**
* notifies all the event plugins about an event
*
* @param eventType
* @param params
* @return
*/
function notifyEvent( $eventType, $params = Array())
{
// check if there is any plugin that wants to be notified about this event
$plugins = Array();
if(array_key_exists( $eventType, $this->_pluginEventList ))
$plugins = $this->_pluginEventList["$eventType"];

if( !is_array($plugins) || empty($plugins))
return $params;

// fill in the parameters array with some other useful information
$params[ "blogInfo" ] = $this->_blogInfo;
$params[ "userInfo" ] = $this->_userInfo;

// if so, loop through the plugins
foreach( $plugins as $plugin ) {
$plugin->setBlogInfo( $this->_blogInfo );
$plugin->setUserInfo( $this->_userInfo );
$plugin->process( $eventType, $params );
}

return $params;
}

/**
* tells the plugin manager that a certain event plugin class wants to be notified about
* a certain event.
*
* @param eventType
* @param pluginClass
* @return Always true
*/
function registerNotification( $eventType, &$pluginClass )
{
// there can be more than one plugin registered for the same event,
// so we need an array of plugin classes
if( !isset($this->_pluginEventList["$eventType"]) || !is_array($this->_pluginEventList["$eventType"])) {
$this->_pluginEventList["$eventType"] = Array();
}

// and then add the plugin to the list
$this->_pluginEventList["$eventType"][] =& $pluginClass;

return true;
}

/**
* returns the events that have been defined
*
* @return An array with the names of the events that have been defined so far
*/
function getDefinedEvents()
{
// get all the constants defined so far
$constants = get_defined_constants();
$events = Array();

foreach( $constants as $constant => $value ) {
// if the constant starts with "EVENT_", it's one of us
if( substr( $constant, 0, 6 ) == "EVENT_" ) {
$events[ "$constant" ] = $value;
}
}

return $events;
}

/**
* returns true if the plugin provides the requested locale
*
* @param pluginId The plugin identifier that we're like to check
* @param localeCode the locale code
* @return True if the plugin has this locale or false otherwise
* @static
*/
function pluginHasLocale( $pluginId, $localeCode )
{
return( File::isReadable( "plugins/$pluginId/locale/locale_{$localeCode}.php" ));
}
}
?>
edub9
 
Posts: 5
Joined: Fri Jan 02, 2009 7:03 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby edub9 on Sat Jan 03, 2009 12:45 pm

Now I have changed the code to this...

$pluginFiles = Glob::myGlob( $this->_pluginDir, "*" );
if( !is_array( $pluginFiles ))
return $pluginList;

But as you can see below the error says this Glob::Glob() instead of this Glob::myGlob?????


Fatal error: Non-static method Glob::Glob() cannot be called statically, assuming $this from incompatible context in /home/johnhawm/public_html/lifetype_evac/class/plugin/pluginmanager.class.php on line 194

Also the plugin folder is empty except for the .htaccess file and the badbehavior file which was there in the beginning...
This is workin my last nerve LOL!

Edub9
edub9
 
Posts: 5
Joined: Fri Jan 02, 2009 7:03 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Sun Jan 04, 2009 6:52 am

What version of php are you using?
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby okie on Sun Jan 04, 2009 3:16 pm

jon can u enlighten me on this too? using PHP 5.2.5 tks!

Fatal error: Non-static method Glob::Glob() cannot be called statically, assuming $this from incompatible context in /home2/********/public_html/blog/class/plugin/pluginmanager.class.php on line 194
okie
 
Posts: 5
Joined: Fri Jan 02, 2009 3:48 pm
LifeType Version: lifetype-1.2.8_r6440

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Sun Jan 04, 2009 9:46 pm

I am not sure. I understand the non-static part, and that it should be changed, but I am not sure why it suddenly happened. Oh, I am running 5.2.6 - I haven't upgraded in a while. Perhaps mine will break when I upgrade. Perhaps the php parser is being more picky than it used to.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby okie on Mon Jan 05, 2009 4:44 am

hi, tks for the feedback. meantime i await any help/input that the rest may hv.

fyi, this is a fresh new install n not an upgrade.

tks again
okie
 
Posts: 5
Joined: Fri Jan 02, 2009 3:48 pm
LifeType Version: lifetype-1.2.8_r6440

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Tue Jan 06, 2009 4:14 am

Hrm, I guess I read your version number incorrectly before, since you are running an older version of php than me, I am not sure why you would be having trouble.

You can try doing this:
Code: Select all
$pluginFiles = Glob::glob( $this->_pluginDir, "*" );

with:
Code: Select all
$glob = new Glob();
$pluginFiles = $glob->Glob($this->_pluginDir, "*");
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby benni on Tue Jan 06, 2009 8:51 am

No, this doesn't use at all. But I've tried another trick, but no idea if there are any disadvantage:

Just set line 194 as a comment:

Code: Select all
//$pluginFiles = Glob::glob( $this->_pluginDir, "*" );


With that trick you can go into the plugin manager. Afraidly I cannot install new plugins, no idea if this is because the comment or if that is another misstage.

Regards, Benni
benni
 
Posts: 12
Joined: Sun Jan 04, 2009 3:14 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Wed Jan 07, 2009 3:06 am

The comment is disabling the search, so that is why you can't install anything new. What happens when you try my method?
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby okie on Wed Jan 07, 2009 6:47 am

hi jon

it's working now :D

tks for the help greatly appreciate it.
okie
 
Posts: 5
Joined: Fri Jan 02, 2009 3:48 pm
LifeType Version: lifetype-1.2.8_r6440

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby benni on Wed Jan 07, 2009 1:06 pm

Hi jon,

afraidly your method causes anouther error message when I want to go into my plugin-settings page. I typed your lines into the file and now, when I click on the link to the plugins center, there is this message on the screen:

Fatal error: Cannot redeclare class EmailMessage in /.../lifetype-1.2.8/class/mail/emailmessage.class.php on line 14

I don't know what to do! :( The file is:

Code: Select all
<?php

   

    define( "MAX_LINE_LENGTH", 998 );

   /**
    * \ingroup Mail
    *
     * Represents an email message and has basic setter and getter methods for all the most
     * basic attributes of an email message (To:, From:, Bcc:, etc)
     */
    class EmailMessage 
    {                                      //this is line 14!

       var $_toAddrs;
        var $_ccAddrs;
        var $_bccAddrs;
        var $_subject;
        var $_body;
        var $_mimeType;
        var $_from;
        var $_fromName;
        var $_charset;
       

       /**
         * Constructor
         */
       function EmailMessage()
        {
           

            $this->_toAddrs = Array();
            $this->_ccAddrs = Array();
            $this->_bccAddrs = Array();
            // use iso-8859-1 as the default character set
            $this->_charset = "iso-8859-1";

            $this->_mimeType = "text/plain";
        }

        /**
         * Adds a destination
         *
         * @param to Destination address.
         */
        function addTo( $to )
        {
           array_push( $this->_toAddrs, rtrim($to) );
        }

      /**
       * Resets the current list of destinations and adds this new one as the only one.
       *
         * @param to Destination address.
       */
      function setTo( $to )
      {
         $this->_toAddrs = Array();
         $this->addTo( $to );
      }

        /**
         * Adds a Cc:
         *
         * @param cc The address where we want to Cc this message
         */
        function addCc( $cc )
        {
           array_push( $this->_ccAddrs, rtrim($cc) );
        }

      /**
       * Resets the current list of Cc destinations and adds this new one as the only one.
       *
         * @param to Destination address.
       */
      function setCc( $to )
      {
         $this->_ccAddrs = Array();
         $this->addCc( $to );
      }

        /**
         * Adds a Bcc address
         *
         * @param bcc The adddress where we want to Bcc
         */
        function addBcc( $bcc )
        {
           array_push( $this->_bccAddrs, rtrim($bcc) );
        }

      /**
       * Resets the current list of Bcc destinations and adds this new one as the only one.
       *
         * @param to Destination address.
       */
      function setBcc( $to )
      {
         $this->_bccAddrs = Array();
         $this->addBcc( $to );
      }

        /**
         * Sets the from address
         *
         * @param from The originatory address
         */
        function setFrom( $from )
        {
           $this->_from = $from;
        }

        /**
         * Sets the from name
         *
         * @param fromname The originatory name
         */
        function setFromName( $fromname )
        {
           $this->_fromName = $fromname;
        }       

        /**
         * Sets the subject of the message
         *
         * @param subject Subject of the message
         */
        function setSubject( $subject )
        {
           $this->_subject = $subject;
        }

        /**
         * Sets the body of the message
         *
         * @param body The text for the body of the message
         */
        function setBody( $body )
        {
           $this->_body = $body;
        }

        /**
         * Sets the MIME type. The default is 'text/plain'
         *
         * @param type The MIME type
         */
        function setMimeType( $type )
        {
           $this->_mimeType = $type;
        }

        /**
         * Returns the "To:" list, properly arranged
         *
         * @return An string with the 'to:' field
         */
        function getTo()
        {
           return $this->_toAddrs;
        }

        /**
         * Returns the "Cc:" list, properly arranged
         *
         * @return An string with the 'Cc:' field
         */
        function getCc()
        {
           return $this->_ccAddrs;
        }

        /**
         * Returns the "Bcc:" list, properly arranged
         *
         * @return An string with the 'Bcc:' field
         */
        function getBcc()
        {
           return $this->_bccAddrs;
        }

        /**
         * Returns the From address.
         *
         * @return The from address.
         */
        function getFrom()
        {
           return $this->_from;
        }

        /**
         * Returns the body.
         *
         * @return The body.
         */
        function getBody()
        {
           return $this->_body;
        }

        /**
         * Returns the subject
         *
         * @return The subject.
         */
        function getSubject()
        {
           return $this->_subject;
        }

        /**
         * Gets the MIME content type of the message
         *
         * @return The MIME type
         */
        function getMimeType()
        {
           return $this->_mimeType;
        }
       
       /**
         * Returns the From name.
         *
         * @return The from name.
         */
        function getFromName()
        {
           return $this->_fromName;
        }
       
        /**
         * Sets the character set of the message
         *
         * @param charset The new character set
         */
        function setCharset( $charset )
        {
            $this->_charset = $charset;
        }
       
        /**
         * Retrieves the character set that was set for this message. Returns
         * by default 'iso-8859-1' if no other has been set
         *
         *Ê@return the character set
         */
        function getCharset()
        {
            return( $this->_charset );
        }
    }
?>


Please help me!

Regards, Benni
benni
 
Posts: 12
Joined: Sun Jan 04, 2009 3:14 pm
LifeType Version: 1.2.8

Re: Fatal error: Non-static method Glob::Glob() cannot be called

Postby jondaley on Thu Jan 08, 2009 6:32 am

What plugins do you have installed? Try removing all of them and adding one at a time.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Next

Return to Configuration and Installation

cron