Trying to get XMPPHP library to work with php 5.3 and beyond

Trying to get XMPPHP library to work with php 5.3 and beyond
Thu, 03/10/2011 - 10:34 | by Todd
#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?

Bringing it up to 5.3+:

Running XMPPHP against an OpenFire Jabber/XMPP server:

'Not supporting crypto' - WAMP - SSL not enabled, WAMP->php Extensions->php_openssl put a checkmark and restart WAMP

Replace all 'split' with 'explode' - just the word, leave all other syntax alone. Appears in line 121 of 'roster.php' and line ??? of XMPP.php

Comment out line 16 of test script - there is no 'subject' in the data

Need to change the test for whether this response is a message or a presence.

>> Notice: Trying to get property of non-object in C:\wamp\www\XMPP_test\XMPPHP\XMPP.php on line 233

This error is when a presence stanza is received - looking for sub('body') but it's not in there. Conditional must be wrong.

"Is Typing:"

XMPPHP_XMLObj Object ( [name] => message [ns] => jabber:client [attrs] => Array ( [id] => msexq-160 [to] => server@chatme.im/xmpphp [from] => guy@chatme.im/spark ) [subs] => Array ( [0] => XMPPHP_XMLObj Object ( [name] => x [ns] => jabber:x:event [attrs] => Array ( [xmlns] => jabber:x:event ) [subs] => Array ( [0] => XMPPHP_XMLObj Object ( [name] => composing [ns] => jabber:x:event [attrs] => Array ( ) [subs] => Array ( ) [data] => ) [1] => XMPPHP_XMLObj Object ( [name] => id [ns] => jabber:x:event [attrs] => Array ( ) [subs] => Array ( ) [data] => 5LoNEq ) ) [data] => ) ) [data] => )

"Actual Message:"

XMPPHP_XMLObj Object ( [name] => message [ns] => jabber:client [attrs] => Array ( [id] => msexq-161 [to] => server@chatme.im/xmpphp [from] => guy@chatme.im/spark [type] => chat ) [subs] => Array ( [0] => XMPPHP_XMLObj Object ( [name] => body [ns] => jabber:client [attrs] => Array ( ) [subs] => Array ( ) [data] => 1234567890 ) [1] => XMPPHP_XMLObj Object ( [name] => thread [ns] => jabber:client [attrs] => Array ( ) [subs] => Array ( ) [data] => 5LoNEq ) [2] => XMPPHP_XMLObj Object ( [name] => x [ns] => jabber:x:event [attrs] => Array ( [xmlns] => jabber:x:event ) [subs] => Array ( [0] => XMPPHP_XMLObj Object ( [name] => offline [ns] => jabber:x:event [attrs] => Array ( ) [subs] => Array ( ) [data] => ) [1] => XMPPHP_XMLObj Object ( [name] => composing [ns] => jabber:x:event [attrs] => Array ( ) [subs] => Array ( ) [data] => ) ) [data] => ) ) [data] => )

Finally,

>> Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\XMPP_test\XMPPHP\XMLStream.php on line 397

This is a WAMP setting. From the php.ini:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

change 30 to something really long. Try 300 for starters and work up from there, maybe???

Note: example is coded to run *forever* or until it sees the other side disconnect. So it's pretty much going to time out eventually? How to handle?

ALSO:
============================================

Message: fclose(): supplied argument is not a valid stream resource
Filename: Xmpphp/XMLStream.php
Line Number: 403

Comment 5 by cente...@gmail.com, Jan 13, 2010
It's easy!
I change the code
if($this->socket)
{
fclose($this->socket);
$this->socket = NULL;
}

Comment 7 by badan...@gmail.com, Jun 9, 2010
I changed line 266 from a split to an explode and that issue didn't occur again.

xmpphp 0.1rc2-r77
PHP 5.3.0
WAMP server 2.0i
-andy

Tags: