| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | --TEST--Test V8::executeString() : Export PHP methods on ArrayAccess objects--SKIPIF--<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>--INI--v8js.use_array_access = 1--FILE--<?phpclass MyArray implements ArrayAccess, Countable {    private $data = Array('one', 'two', 'three');    public function offsetExists($offset) {	return isset($this->data[$offset]);    }    public function offsetGet($offset) {	return $this->data[$offset];    }    public function offsetSet($offset, $value) {	echo "set[$offset] = $value\n";	$this->data[$offset] = $value;    }    public function offsetUnset($offset) {        throw new Exception('Not implemented');    }    public function count() {	echo 'count() = ', count($this->data), "\n";        return count($this->data);    }    public function phpSidePush($value) {	echo "push << $value\n";	$this->data[] = $value;    }}$v8 = new V8Js();$v8->myarr = new MyArray();/* Call PHP method to modify the array. */$v8->executeString('PHP.myarr.phpSidePush(23);');var_dump(count($v8->myarr));var_dump($v8->myarr[3]);/* And JS should see the changes due to live binding. */$v8->executeString('var_dump(PHP.myarr.join(","));');?>===EOF===--EXPECT--push << 23count() = 4int(4)int(23)count() = 4string(16) "one,two,three,23"===EOF===
 |