public function execute(\PHPPHP\Engine\ExecuteData $data) { if ($this->op1->isVariable()) { $varName = $this->op1->getName(); if (!isset($data->symbolTable[$varName])) { $this->result->setValue(true); $data->nextOp(); return; } } $this->result->setValue(!$this->op1->getValue()); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->op1->separateIfNotRef(); if (!$this->op1->isArray()) { if ($this->op1->isNull()) { $this->op1->setValue(array()); } else { throw new \RuntimeException('Cannot use a scalar value as an array'); } } $array =& $this->op1->getArray(); if ($this->dim) { $key = $this->dim->toString(); if (isset($array[$key])) { $array[$key]->forceValue($this->op2->getZval()); } else { $array[$key] = Zval::ptrFactory($this->op2->getZval()); } } else { $array[] = Zval::ptrFactory($this->op2->getZval()); } if ($this->result) { $this->result->setValue($this->op2->getZval()); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $val = $this->op1->getValue(); $this->op1->setValue(++$val); $this->result->setValue($this->op1); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $varName = $this->op1->getName(); $ret = isset($data->symbolTable[$varName]) && !$data->symbolTable[$varName]->isNull(); $this->result->setValue($ret); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $command = $this->op1->getValue(); $result = `{$command}`; $this->result->setValue($result); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $name = $this->op1->toString(); $functionData = $this->op2; $data->executor->getFunctionStore()->register($name, $functionData); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $consts = $data->executor->getConstantStore(); $value = $consts->get($this->op1->toString()); $this->result->setValue($value); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $key = $this->op2->getValue(); if ($this->op1->isArray()) { $array =& $this->op1->getArray(); if (!isset($array[$key])) { if ($this->write) { $array[$key] = Zval::ptrFactory(); $this->result->setValue($array[$key]); } else { $this->result->setValue(Zval::ptrFactory()); } } else { $this->result->setValue($array[$key]); } } elseif ($this->op1->isString()) { $value = $this->op1->getValue(); if (isset($value[$key])) { $this->result->setValue($value[$key]); } else { $this->result->setValue(''); } } elseif ($this->write && $this->op1->isNull()) { $value = Zval::ptrFactory(); $this->op1->setValue(array($key => $value)); $this->result->setValue($value); } else { throw new \RuntimeException('Cannot use a scalar value as an array'); } if ($this->write) { $this->result->getZval()->makeRef(); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { if ($this->op1->toBool()) { $data->jump($this->op2); return; } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { if ($this->op2) { $this->op2->setValue($this->op1->getIterator()->key()); } $this->result->setValue($this->op1->getIterator()->current()); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $ret = $this->op1->getZval(); $this->result->setValue($ret); $val = $this->op1->getValue(); $this->op1->setValue(--$val); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $varName = $this->op1->toString(); if (!isset($data->executor->executorGlobals->symbolTable[$varName])) { $data->executor->executorGlobals->symbolTable[$varName] = Zval::ptrFactory(); } $data->symbolTable[$varName] = $data->executor->executorGlobals->symbolTable[$varName]; $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->result->setIterator($this->op1->getIterator()); if (!$this->result->getIterator()->valid()) { $data->jump($this->op2); } else { $data->nextOp(); } }
public function execute(\PHPPHP\Engine\ExecuteData $data) { if (0 == $this->op2->getValue()) { $this->result->setValue(false); } else { $this->result->setValue($this->op1->getValue() % $this->op2->getValue()); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $value = $this->getValue(); if (0 == $value) { $this->setValue(false); } else { $this->setValue($value / $this->op2->getValue()); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $fileName = $data->opArray->getFileName() . '(' . $this->lineno . ") : eval()'d code"; $code = $this->op1->toString(); $opCodes = $data->executor->compile('<?php ' . $code, $fileName); $return = $data->executor->execute($opCodes, $data->symbolTable); if ($return) { $this->result->setValue($return); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $key = $this->op1->toString(); $array = $this->result->toArray(); $var = Zval::ptrFactory($this->op2->getZval())->separateIfRef(); if ($key) { $array[$key] = $var; } else { $array[] = $var; } $this->result->setValue($array); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $varName = $this->op1->toString(); $var = $data->fetchVariable($varName); if (!$this->value) { $var->makeRef(); $this->value = $var; if ($this->op2) { $var->setValue($this->op2); } } $var->assignZval($this->value); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $functionCall = $data->executor->executorGlobals->call; $args = array(); $stack = $data->executor->getStack(); for ($i = $stack->count() - 1; $i >= 0; $i--) { $args[] = $stack->pop(); } $args = array_reverse($args); if (!$this->result) { $this->result = Zval::ptrFactory(); } $functionCall->execute($args, $this->result); $data->executor->executorGlobals->call = null; $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { if ($this->op1->isString()) { $ce = $data->executor->getClassStore()->get($this->op1->getValue()); } else { if ($this->op1->isObject()) { $ce = $this->op1->getValue()->getClassEntry(); } else { throw new \RuntimeException('Class name must be a valid object or a string'); } } $consts = $ce->getConstantStore(); $value = $consts->get($this->op2->toString()); $this->result->setValue($value); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $args = $data->arguments; $n = $this->op1->toLong(); $param = $data->function->getParam($n); if ($param) { $var = $data->fetchVariable($param->name); if ($param->isRef) { $var->assignZval($args[$n]->getZval()); $var->addRef(); } else { $var->setValue($args[$n]); } } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $className = $this->op1; $funcName = $this->op2->toString(); if ($className->isString()) { $ce = $data->executor->getClassStore()->get($className->getValue()); } else { if ($className->isObject()) { $ce = $className->getValue()->getClassEntry(); } else { throw new \RuntimeException('Class name must be a valid object or a string'); } } $functionData = $ce->getMethodStore()->get($funcName); $data->executor->executorGlobals->call = new Engine\FunctionCall($data->executor, $functionData, null, $ce); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $ci = $this->op1; $funcName = $this->op2->toString(); if ($ci) { if ($ci->isObject()) { $ci = $ci->getValue(); $functionData = $ci->getClassEntry()->getMethodStore()->get($funcName); } else { throw new \RuntimeException(sprintf('Call to a member function %s() on a non-object', $funcName)); } } else { $functionData = $data->executor->getFunctionStore()->get($funcName); } $data->executor->executorGlobals->call = new Engine\FunctionCall($data->executor, $functionData, $ci); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $ptr = null; if ($data->executor->executorGlobals->call->getFunction()->isArgByRef($this->op2->getValue())) { if ($this->op1->isVariable() || $this->op1->isRef() || $this->op1->isObject()) { $op = $this->op1->getPtr(); $op->makeRef(); $op->addRef(); $ptr = Zval::ptrFactory($op->getZval()); } else { throw new \RuntimeException("Can't pass parameter {" . $this->op2->getValue() . "} by reference"); } } else { $ptr = Zval::ptrFactory($this->op1->getValue()); } $data->executor->getStack()->push($ptr); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $fileName = $this->op2->toString(); if (substr($fileName, 0, 1) !== '/') { $fileName = $data->executor->executorGlobals->cwd . '/' . $fileName; } $fileName = realpath($fileName); if (!is_file($fileName)) { throw new \RuntimeException('Including bad file!'); } switch ($this->op1->getValue()) { case IncludeNode::TYPE_INCLUDE_ONCE: case IncludeNode::TYPE_REQUIRE_ONCE: if ($data->executor->hasFile($fileName)) { break; } case IncludeNode::TYPE_INCLUDE: case IncludeNode::TYPE_REQUIRE: $opCodes = $data->executor->compileFile($fileName); $data->executor->execute($opCodes); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->op2->makeRef(); $zval = $this->op2->getZval(); if ($this->property) { $this->op1->getValue()->setProperty($this->property->toString(), $zval); } else { if ($this->dim) { $array =& $this->op1->getArray(); $key = $this->property->toString(); if (isset($array[$key])) { $array[$key]->forceValue($zval); } else { $array[$key] = Zval::ptrFactory($zval); } } else { $this->op1->forceValue($zval); } } if ($this->result) { $this->result->setValue($zval); } $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->result->setValue($this->op1->getValue() < $this->op2->getValue()); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $ce = $this->op1; $data->executor->getClassStore()->register($ce); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->op1->setValue(null); $data->nextOp(); }
public function execute(\PHPPHP\Engine\ExecuteData $data) { $this->result->setValue(!$this->op1->isEqualTo($this->op2)); $data->nextOp(); }