Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Do not filter non-empty IRC command parameters which cast to boolean false #53

Merged
merged 1 commit into from
Dec 19, 2018
Merged

Do not filter non-empty IRC command parameters which cast to boolean false #53

merged 1 commit into from
Dec 19, 2018

Conversation

Renegade334
Copy link
Contributor

EventQueue::ircPrivmsg('#channel', '0');

currently yields:

PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function Phergie\Irc\Client\React\WriteStream::ircPrivmsg(), 1 passed and exactly 2 expected in /truncated/vendor/phergie/phergie-irc-client-react/src/WriteStream.php:432
Stack trace:
#0 [internal function]: Phergie\Irc\Client\React\WriteStream->ircPrivmsg('#channel')
#1 /truncated/vendor/phergie/phergie-irc-bot-react/src/Bot.php(533): call_user_func_array(Array, Array)
#2 /truncated/vendor/phergie/phergie-irc-bot-react/src/Bot.php(498): Phergie\Irc\Bot\React\Bot->processOutgoingEvents(Object(Phergie\Irc\Connection), Object(Phergie\Irc\Client\React\WriteStream))
#3 /truncated/vendor/phergie/phergie-irc-bot-react/src/Bot.php(466): Phergie\Irc\Bot\React\Bot->processClientEvent('irc.sent', Array, Object(Phergie\Irc\Connection), Object(Phergie\Irc\Client\React\WriteStream))
#4 /truncated/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Phergie\Irc\Bot\React\Bot->Phergie\Irc\Bot\React\{closure}(' in /truncated/vendor/phergie/phergie-irc-client-react/src/WriteStream.php on line 432

due to the following line in EventQueue::queueRequest:

$event->setParams(array_filter($params));

which filters any string that casts to boolean false.

Using the callback strlen mitigates against this, by filtering out empty variables and zero-length strings, but not '0'.

@svpernova09 svpernova09 merged commit 17745ef into phergie:master Dec 19, 2018
@svpernova09
Copy link
Member

Thanks for the fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants