File tree 4 files changed +10
-7
lines changed
4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ void Context::assign(Php::Parameters ¶ms)
141
141
*
142
142
* @param params array with one parameter: the code to execute
143
143
* @return Php::Value
144
+ * @throws Php::Exception
144
145
*/
145
146
Php::Value Context::evaluate (Php::Parameters ¶ms)
146
147
{
@@ -196,14 +197,11 @@ Php::Value Context::evaluate(Php::Parameters ¶ms)
196
197
// in case we timeout we must terminate execution
197
198
if (status != std::cv_status::timeout) return ;
198
199
199
- // create a handle, so the local variable created below falls out of scope
200
+ // create a handle for the local variable that is created by dereferencing _context
200
201
v8::HandleScope scope (Isolate::get ());
201
202
202
- // access the main threads context
203
- v8::Local<v8::Context> context (_context);
204
-
205
203
// terminate execution
206
- context ->GetIsolate ()->TerminateExecution ();
204
+ _context ->GetIsolate ()->TerminateExecution ();
207
205
}));
208
206
209
207
// execute the script
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ class Context : public Php::Base
116
116
*
117
117
* @param params array with one parameter: the code to execute
118
118
* @return Php::Value
119
+ * @throws Php::Exception
119
120
*/
120
121
Php::Value evaluate (Php::Parameters ¶ms);
121
122
};
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ class Stack
91
91
*
92
92
* @return v8::Local<T>
93
93
*/
94
- operator v8::Local<T> () const
94
+ operator const v8::Local<T> () const
95
95
{
96
96
// create the value
97
97
return v8::Local<T>::New (Isolate::get (), _handle);
Original file line number Diff line number Diff line change 2
2
3
3
$ context = new JS \Context ();
4
4
5
- $ context ->evaluate ("3; " , 5 );
5
+ for ($ i = 1 ; $ i <= 1000000 ; $ i ++)
6
+ {
7
+ if ($ i % 1000 == 0 ) echo ($ i . PHP_EOL );
8
+ $ context ->evaluate ("$ i; " , 1 );
9
+ }
You can’t perform that action at this time.
0 commit comments