@@ -645,13 +645,15 @@ class PhpObject::PhpInvokeMsg : public MessageToPhp {
645645 public:
646646 PhpInvokeMsg (ObjectMapper *m, Nan::Callback *callback, bool is_sync,
647647 objid_t obj, v8::Local<v8::String> method,
648- const Nan::FunctionCallbackInfo<v8::Value> & info)
648+ const Nan::FunctionCallbackInfo<v8::Value> * info)
649649 : MessageToPhp(m, callback, is_sync), method_(m, method),
650- argc_ (info. Length()), argv_(Value::NewArray(m, info) ),
650+ argc_ (info-> Length ()), argv_(),
651651 should_convert_array_to_iterator_(false ) {
652652 obj_.SetJsObject (obj);
653+ argv_.SetArrayByValue (argc_, [m, info](uint32_t idx, Value& v) {
654+ v.Set (m, (*info)[idx]);
655+ });
653656 }
654- ~PhpInvokeMsg () override { delete[] argv_; }
655657 inline bool should_convert_array_to_iterator () {
656658 return should_convert_array_to_iterator_;
657659 }
@@ -803,7 +805,7 @@ class PhpObject::PhpInvokeMsg : public MessageToPhp {
803805 Value obj_;
804806 Value method_;
805807 int argc_;
806- Value * argv_;
808+ Value argv_;
807809 bool should_convert_array_to_iterator_;
808810};
809811
@@ -824,7 +826,7 @@ void PhpObject::MethodThunk_(v8::Local<v8::String> method,
824826 return Nan::ThrowError (" Invocation after PHP request has completed." );
825827 }
826828 PhpInvokeMsg msg (channel_, nullptr , true , // Sync call.
827- id_, method, info);
829+ id_, method, & info);
828830 channel_->SendToPhp (&msg, MessageFlags::SYNC);
829831 THROW_IF_EXCEPTION (" PHP exception thrown during method invocation" , /* */ );
830832 if (msg.retval ().IsEmpty ()) {
0 commit comments