2012-04-27 16:26:15 +00:00
|
|
|
--TEST--
|
2015-04-26 11:49:13 +00:00
|
|
|
Test V8::executeString() : Forcing to arrays (return value conversion)
|
2012-04-27 16:26:15 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$js = <<<'EOT'
|
|
|
|
var a = { 'hello' : 'world' }; a;
|
|
|
|
EOT;
|
|
|
|
|
|
|
|
$v8 = new V8Js();
|
|
|
|
|
|
|
|
try {
|
|
|
|
var_dump($v8->executeString($js, 'assoc_no_flags.js'));
|
|
|
|
echo "---\n";
|
|
|
|
var_dump($v8->executeString($js, 'assoc_force_to_array.js', V8Js::FLAG_FORCE_ARRAY));
|
2013-04-13 23:36:31 +00:00
|
|
|
} catch (V8JsScriptException $e) {
|
2012-04-27 16:26:15 +00:00
|
|
|
var_dump($e);
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
===EOF===
|
2013-10-29 19:26:16 +00:00
|
|
|
--EXPECTF--
|
|
|
|
object(V8Object)#%d (1) {
|
2012-04-27 16:26:15 +00:00
|
|
|
["hello"]=>
|
|
|
|
string(5) "world"
|
|
|
|
}
|
|
|
|
---
|
|
|
|
array(1) {
|
|
|
|
["hello"]=>
|
|
|
|
string(5) "world"
|
|
|
|
}
|
|
|
|
===EOF===
|