Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 29, 2024. It is now read-only.
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Call to undefined method V8\ObjectValue::value() #106

Closed
@qodeboy

Description

Trying to extend bundled example to work with object, I'm not able to get value. Consider following code:

$isolate = new \V8\Isolate();
$context = new \V8\Context($isolate);
$source = new \V8\StringValue($isolate, "var say = function() {return {foo: 'bar'};}; say();");
$script = new \V8\Script($context, $source);
$result = $script->run($context);
echo $result->value() . PHP_EOL;

I understand that return value is no longer StringValue but ObjectValue instead. How do I properly get it's value?

My use-case is rendering VueJS app on server to implement server side rendering. For this, I need to execute some wrapper javascript and app itself on the server. This js code results in ObjectValue just like my example above. If I try to do $result->toString($context)->value() I get [object Object] which is not usable. What is a correct way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /