[geeklog-modules] HELP REQ: Strange PHP behavior in GL

Evan Dorn geeklog-modules-user at lrdesign.com
Sun Apr 6 18:45:35 EDT 2003


I'm trying to implement a hack to ping weblogs.com whenever a new story 
is successfully submitted.  I've hit a weird bug.

There are PHP objects I use that function fine on their own or in other 
PHP scripts, but are broken if I use them from within Geeklog.  I use 
the XMLRPC implementation for PHP, but you don't necessarily have to 
know anything about XMLRPC or it's PHP implementation to understand 
this code or the problem.  Just know that "xmlrpcval" is an object that 
is serializable, and its behavior breaks if it's used from inside GL.  
I can set and retrieve values in this object in any other PHP code, but 
inside GL this object produces nothing when I set and then retrieve a 
value.

The code fragment I'm running is:

function phpblock_rpcserialize()
{
include("xmlrpc.inc");
$v=new xmlrpcval("foobar","string");
$retval = "value is:<BR><PRE>" . htmlentities($v->serialize()) . 
"</PRE>";
return $retval;
}

xmlrpc.inc contains the definition of the xmlrpcval object. 
Alternatively, I can just put the same code in its own PHP file, and 
just use print $retval; for the last line.

In a plain PHP file, the code gives this output:

value is:
<value><string>foobar</string></value>

which is the XML output I expect from this object.  But from inside a 
phpblock (or any other place within GL), the same code gives a 
different output:

value is:
<value></value>

Clearly, GL is somehow interfering with xmlrpcval's ability to function 
correctly; either to set, store, or serialize values.  I'm not sure if 
I should be looking for GL identifiers that interfere with identifiers 
in xmlrpc.inc, or what.  I'm not so familiar with PHP that I have a 
handle on whether variable scope could be an issue or not.

You can see these bits of code live.  These two items have identical 
code:

In a separate php file:
http://www.idahoev.com/vardemo.php

In a GL phpblock:
http://www.idahoev.com/    click on topic "Testing Grounds", and look 
at the bottom-right block.

Any suggestions of what to look for would be appreciated.
Thanks,
IdahoEv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2135 bytes
Desc: not available
URL: <https://pairlist8.pair.net/pipermail/geeklog-modules/attachments/20030406/3f8780c5/attachment.bin>


More information about the geeklog-modules mailing list