WildPHP / irc-bot

A simple and modular PHP IRC bot
MIT License
84 stars 24 forks source link

Bot crash when certain user join or quits #58

Closed snyte closed 7 years ago

snyte commented 8 years ago

Bot always crash when this user appear(quit and join)

NanoSector commented 8 years ago

Hi snyte, thanks for your report!

Are you using the master branch or the architecture-rework branch?

snyte commented 8 years ago

Master

NanoSector commented 8 years ago

I am unable to reproduce this in architecture-rework. It is probably a module causing the crash.

snyte commented 8 years ago

Well i said master branch

Fatal error: Uncaught exception 'ErrorException' with message 'Undefined index: message in G:\xampp\ircbot\lib\WildPHP\Connection\IrcConnection.php on line 148' in G:\xampp\ircbot\wildphp.php:52 Stack trace:

0 G:\xampp\ircbot\lib\WildPHP\Connection\IrcConnection.php(148): {closure}(8, 'Undefined index...', 'G:\xampp\ircbot...', 148, Array)

1 [internal function]: WildPHP\Connection\IrcConnection->processData(':lupine!~lupine...', Object(React\Stream\Stream))

2 G:\xampp\ircbot\vendor\evenement\evenement\src\Evenement\EventEmitterTrait.php(64): call_user_func_array(Array, Array)

3 G:\xampp\ircbot\vendor\react\stream\src\Stream.php(123): Evenement\EventEmitter->emit('data', Array)

4 [internal function]: React\Stream\Stream->handleData(Resource id #89, Object(React\EventLoop\StreamSelectLoop))

5 G:\xampp\ircbot\vendor\react\event-loop\StreamSelectLoop.php(227): call_user_func(Array, Resource id #89, Object(React\EventLoop\StreamSelectLoop))

6 G:\xampp\ircbot\vendor\react\event-loop\StreamSelectLoop.php(201): React\Eve in G:\xampp\ircbot\wildphp.php on line 52

i suspect it's due to the "[ooo]" part of his join message

NanoSector commented 8 years ago

Hmm that would require further testing, might be a bug in the parser component. I'll look into it, thanks again for reporting :)

snyte commented 8 years ago

It's not only lupine, just noticed more of them

So quakenet.org part is the issue?

snyte commented 8 years ago

Created a workaround that seems to fix it In vendor\react\stream\src\Stream.php

public function handleData($stream) added lines $data=strtolower($data); $data=str_replace("[ooo]","",$data);

NanoSector commented 8 years ago

I've been able to confirm this recently by having FatalException live.

It seems the IRC parser we use from the Phergie project is too strict about the IRC RFC, which is often ignored in real-world examples.

I'll have a chat with them about this, but seeing as they specifically made the parser to comply to the RFC, they most likely won't change this. In that case I'll look at creating an alternative or forking it and making it less compliant.

Another solution would be using grawity's parser which doesn't have association and other fanciness: https://github.com/grawity/hacks/tree/master/irc/parsers/php But it seems better aimed at real-world conventions. Do note that this does break API compatibility so it may be better to do this in a future big release.

NanoSector commented 8 years ago

This should be fixed in 3.0 once #66 is done.

NanoSector commented 7 years ago

No longer an issue.