Example #1
0
 function fillMap($index)
 {
     if (!isset($this->refmap->classlist[$index])) {
         throw new HessianParsingException("Class def index {$index} not found");
     }
     $classdef = $this->refmap->classlist[$index];
     $localType = $this->typemap->getLocalType($classdef->type);
     $obj = $this->objectFactory->getObject($localType);
     $this->refmap->incReference();
     $this->refmap->objectlist[] = $obj;
     foreach ($classdef->props as $prop) {
         $item = $this->parse();
         if (HessianRef::isRef($item)) {
             $item =& $this->refmap->objectlist[$item->index];
         }
         $obj->{$prop} = $item;
         unset($item);
         // reported as fix to issue 15, test are successful. Thanx ruben.wa...
     }
     return $obj;
 }
Example #2
0
 function parseMap($code, $num)
 {
     if ($this->read(1) != 't') {
         throw new HessianParsingException('Malformed map format: expected t');
     }
     $type = $this->parseString($code, ord($num));
     $localType = $this->typemap->getLocalType($type);
     if (!$localType) {
         $map = array();
     } else {
         $map = $this->objectFactory->getObject($localType);
     }
     $this->refmap->incReference();
     $this->refmap->objectlist[] =& $map;
     $code = $this->read(1);
     while ($code != 'z') {
         $key = $this->parse($code);
         $value = $this->parse();
         if (HessianRef::isRef($key)) {
             $key =& $this->refmap->objectlist[$key->index];
         }
         if (HessianRef::isRef($value)) {
             $value =& $this->refmap->objectlist[$value->index];
         }
         if (!$localType) {
             $map[$key] = $value;
         } else {
             $map->{$key} = $value;
         }
         $code = $this->read(1);
     }
     return $map;
 }