@@ -645,13 +645,15 @@ class PhpObject::PhpInvokeMsg : public MessageToPhp {
645
645
public:
646
646
PhpInvokeMsg (ObjectMapper *m, Nan::Callback *callback, bool is_sync,
647
647
objid_t obj, v8::Local<v8::String> method,
648
- const Nan::FunctionCallbackInfo<v8::Value> & info)
648
+ const Nan::FunctionCallbackInfo<v8::Value> * info)
649
649
: MessageToPhp(m, callback, is_sync), method_(m, method),
650
- argc_ (info. Length()), argv_(Value::NewArray(m, info) ),
650
+ argc_ (info-> Length ()), argv_(),
651
651
should_convert_array_to_iterator_(false ) {
652
652
obj_.SetJsObject (obj);
653
+ argv_.SetArrayByValue (argc_, [m, info](uint32_t idx, Value& v) {
654
+ v.Set (m, (*info)[idx]);
655
+ });
653
656
}
654
- ~PhpInvokeMsg () override { delete[] argv_; }
655
657
inline bool should_convert_array_to_iterator () {
656
658
return should_convert_array_to_iterator_;
657
659
}
@@ -803,7 +805,7 @@ class PhpObject::PhpInvokeMsg : public MessageToPhp {
803
805
Value obj_;
804
806
Value method_;
805
807
int argc_;
806
- Value * argv_;
808
+ Value argv_;
807
809
bool should_convert_array_to_iterator_;
808
810
};
809
811
@@ -824,7 +826,7 @@ void PhpObject::MethodThunk_(v8::Local<v8::String> method,
824
826
return Nan::ThrowError (" Invocation after PHP request has completed." );
825
827
}
826
828
PhpInvokeMsg msg (channel_, nullptr , true , // Sync call.
827
- id_, method, info);
829
+ id_, method, & info);
828
830
channel_->SendToPhp (&msg, MessageFlags::SYNC);
829
831
THROW_IF_EXCEPTION (" PHP exception thrown during method invocation" , /* */ );
830
832
if (msg.retval ().IsEmpty ()) {
0 commit comments