Josh Schumacher: A PHP Developer

The biggest and the best in the Northwest

Josh Schumacher: A PHP Developer random header image

Fixing NIL errors from ‘XML-RPC for PHP’ library

April 25th, 2012 · 1 Comment

I was working with the pyapns push server, sending XML-RPC requests from PHP. A common response from pyapns is <nil/> which isn’t handled by default correctly by XML-RPC for PHP and instead you are given the error, 'Invalid return payload: enable debugging to examine incoming payload found not-xmlrpc xml element NIL'.

To solve this error, there is a $GLOBAL variable you can set after you have included xmlprc.inc that will change how the library interacts with nil elements.

  1. require_once('lib/xmlrpc.inc');
  2. $GLOBALS['xmlrpc_null_extension'] = true; // correctly handle <NIL> responses from pyapns
  3. $client = new xmlrpc_client(PYAPNS_RPC_PATH, PYAPNS_HOST, PYAPNS_PORT);

Tags: Uncategorized

1 response so far ↓

  • 1 JON // Sep 9, 2014 at 10:11 pm

    THANKS!!!!

Leave a Comment