php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57525 Importing classes does not work, using the PHP command line.
Submitted: 2007-02-13 10:22 UTC Modified: 2013-02-26 04:32 UTC
From: info at lucasvd dot nl Assigned:
Status: Not a bug Package: runkit (PECL)
PHP Version: 5.2.0 OS: Windows Vista/Debian
Private report: No CVE-ID: None
 [2007-02-13 10:22 UTC] info at lucasvd dot nl
Description:
------------
I'm creating an IRC Bot, with plugins. All my Plugins are classes, so if you made a change to your plugin, you hadd to restart to complete bot, to reload all plugins. But then I met runkit, and it would be the perfect solution.

But, when I ry to reload all my plugins using Runkit, runkit_import returns true, but the classes aren't reloaded. (When I started the bot through the PHP CLI)

Runkit did actually work when I started the bot through my browser.

Reproduce code:
---------------
	public function reload_plugins()
	{
		// Check for runkit extension
		if(!extension_loaded('runkit'))
		{
			// Try to load it
			@dl('runkit');
			if(!extension_loaded('runkit'))
			{
				throw new Exception('Runkit extension not installed!');
			}
		}

		// Loop through all plugins
		foreach($this -> plugins as $name => $instance)
		{
			if(runkit_import($this ->plugin_dir . $name.'/plugin.php', RUNKIT_IMPORT_OVERRIDE | RUNKIT_IMPORT_CLASSES))
			{
				$this -> logger -> add($name.' Succesfully reloaded', IrcEvent::Other);
			}
		}
	}

Expected result:
----------------
Classes are reloaded, without have to restart my bot.

Actual result:
--------------
On the PHP CLI, the classes aren't reloaded.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-09 19:22 UTC] tagyboy at gmail dot com
Does not work on Gentoo neither.
 [2013-02-26 04:32 UTC] pollita@php.net
-Status: Open +Status: Not a bug
 [2013-02-26 04:32 UTC] pollita@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

I'm pretty sure this is fixed at this point, please try newest version in git.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jun 19 10:01:27 2019 UTC