X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=blobdiff_plain;f=src%2FValue.php;h=97852b05ea1c56d4488fd369b24f999c9e6af8ac;hp=d48f0b8ff440fc61a8cf81cd15d23aa83019915a;hb=b5d242c678774aa0952497d77379f61efad733ec;hpb=b0a92b19241515e3484421bfc08ec13a54a2eb1c diff --git a/src/Value.php b/src/Value.php index d48f0b8..97852b0 100644 --- a/src/Value.php +++ b/src/Value.php @@ -113,7 +113,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess } // coerce booleans into correct values - // NB: we should either do it for datetimes, integers and doubles, too, + // NB: we should either do it for datetimes, integers, i8 and doubles, too, // or just plain remove this check, implemented on booleans only... if ($type == static::$xmlrpcBoolean) { if (strcasecmp($val, 'true') == 0 || $val == 1 || ($val == true && strcasecmp($val, 'false'))) { @@ -329,14 +329,10 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess */ public function serialize($charsetEncoding = '') { - // add check? slower, but helps to avoid recursion in serializing broken xmlrpc values... - //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval'))) - //{ reset($this->me); list($typ, $val) = each($this->me); return '' . $this->serializedata($typ, $val, $charsetEncoding) . "\n"; - //} } /** @@ -407,7 +403,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess /** * Returns the type of the xmlrpc value. * - * For integers, 'int' is always returned in place of 'i4' or 'i8'. + * For integers, 'int' is always returned in place of 'i4'. 'i8' is considered a separate type and returned as such * * @return string */ @@ -415,7 +411,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess { reset($this->me); list($a,) = each($this->me); - if ($a == static::$xmlrpcI4 || $a == static::$xmlrpcI8) { + if ($a == static::$xmlrpcI4) { $a = static::$xmlrpcInt; } @@ -501,7 +497,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess return new \ArrayIterator(); } - public function offsetSet($offset, $value) { switch ($this->mytype) { @@ -528,7 +523,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess } return; case 1: -// todo: handle i4/i8 vs int +// todo: handle i4 vs int reset($this->me); list($type,) = each($this->me); if ($type != $offset) { @@ -549,7 +544,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess case 2: return isset($this->me['array'][$offset]); case 1: -// todo: handle i4/i8 vs int +// todo: handle i4 vs int return $offset == $this->scalartyp(); default: return false;