Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Three improvements:

1. $nomoodlecookie = true. I just found out about this undocumented(?) hack(?)
   in lib/setup.php which is the perfect way to suppress some warnings. We
   don't need a session cookie for the chatd.

2. If allow_call_time_pass_reference is Off, socket_getpeername can't work.

3. Suppress "call time pass by reference is deprecated" messages for
   socket_getpeername, we don't have any choice here.
  • Loading branch information...
commit df1cbe9f48de0e83f2f21ff5dd8df970742b2449 1 parent a26a0e2
defacer authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 mod/chat/chatd.php
View
8 mod/chat/chatd.php
@@ -27,6 +27,8 @@
$_SERVER['SERVER_NAME'] = 'dummy';
$_SERVER['HTTP_USER_AGENT'] = 'dummy';
+$nomoodlecookie = true;
+
include('../../config.php');
include('lib.php');
@@ -42,6 +44,10 @@
die("Error: Cannot run with PHP safe_mode = On. Turn off safe_mode in php.ini.\n");
}
+if(ini_get('allow_call_time_pass_reference') == '0') {
+ die("Error: Cannot run with PHP allow_call_time_pass_reference = Off. Turn on allow_call_time_pass_reference in php.ini.\n");
+}
+
@set_time_limit (0);
set_magic_quotes_runtime(0);
error_reporting(E_ALL);
@@ -65,7 +71,7 @@ class ChatConnection {
function ChatConnection($resource) {
$this->handle = $resource;
- socket_getpeername($this->handle, &$this->ip, &$this->port);
+ @socket_getpeername($this->handle, &$this->ip, &$this->port);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.