remote scripting for php4
| From: | giancarlo at navigare dot net | Date: | Mon, 23 Oct 2000 06:55:15 +0000 |
| Subject: | remote scripting for php4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21749@lists.php.net to get a copy of this message | ||
Hi,
I've gone through trying ta adapt your (John Smirl's) php implementation
of remote
scripting as posted sometime ago in the php mailing list
http://marc.theaimsgroup.com/?l=php-general&m=92121296023300&w=2
I got it almost working with a few major differences:
gettype() doesn't return anymore 'user function' on enumerating an
object's elements, although is now documented in the PHP4 manual
I opened a bug on it but hey seem unwilling to fix and try to put it
among 'documentation bugs'
Nevertheless now I used the new php4
method_exists($ojectname,$methodname)
function.
There are a few new gotchas as a new gettype() 'boolean' exists, which I
included among the others in the various switch cases.
Then I found a bug in your rs.inc script, as distributed through the
list in 1999, on line 231
function array_unevalDecl($obj) {
$__decl = unevalGetNextID();
$r = '';
$s = 'var ' . $__decl . '= new Array(' . count($obj) . ');';
for ($i = 0; $i < count($obj); $i++) {
$r .= unevalDecl($obj[i]); ##### should be $obj[$i] here #######
$s .= $__decl . '[' . $i . ']=' . unevalInst($obj[$i]) . ';';
}
return $r . $s . $__decl . ';';
}
I cant clean it all up yet, but it is basically working, at least for
'objects' types.
You can find differences in the attached rs.inc source by searching
'!!!'
It was pleasing to read your code, and now I know remote scripting some
better, although it's quite hard to debug. Surely you'll find more
things. Let me know or post to the php list, please.
Giancarlo