So I've been trying to get an IRC bot working with PHP, to run locally. However, I want it to be able to retrieve information from a site, and post this information periodically. So I installed pthreads to do that. However, I'm having a bit of trouble with Referencing variables.
This is the error I get, when attempting to connect the bot to the channel.
Fatal error: Cannot assign by reference to overloaded object in C:\Apache24\htdo cs\muhbot.php on line 128
Here is the code that it's giving me an error on. Line 128 is the last line of the __construct() function.
class recheck extends Thread {
var $lastCheck,$bot;
public function __construct(&$bot){
$this->lastCheck = microtime(true);
$this->bot = &$bot;
}
$bot is the class object that manages the IRC connection. The class is created by a function inside that class.
function startCheck()
{
$ReChecker = new recheck($this);
$ReChecker->start();
}
I'm trying to pass the main class as a reference, but keep getting the fatal error from above. Why am I getting this error, and how do I fix/work around it?