Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return V8Object is endless iterable #316

Closed
HoffmannP opened this issue Jun 8, 2017 · 1 comment · Fixed by #318
Closed

Return V8Object is endless iterable #316

HoffmannP opened this issue Jun 8, 2017 · 1 comment · Fixed by #318

Comments

@HoffmannP
Copy link
Contributor

HoffmannP commented Jun 8, 2017

The following script produces an endless steam of lines containing "test: test":

<?php

$jscript = new V8Js();
$jscript->executeString("values = {}");
$jscript->executeString("values['test'] = 'test'");
$values = $jscript->executeString("values");

foreach ($values as $key => $value) {
    echo "$key: $value\n";
}
@HoffmannP HoffmannP changed the title Return object is endless iterable Return V8Object is endless iterable Jun 8, 2017
stesie added a commit to stesie/v8js that referenced this issue Jun 8, 2017
stesie added a commit to stesie/v8js that referenced this issue Jun 8, 2017
@stesie
Copy link
Member

stesie commented Jun 8, 2017

Nice catch :-)

PHP allows V8Js to refresh the properties after every round of iteration ... and V8js rebuilds the table from scratch every time (primarily to reflect properties being removed meanwhile), yet this resets the iterator heads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants