title: PHP COM('word.application') functions and methods parameters issue
body: <p>I'm using php and new COM('word.application') to manipulate a .doc file (add and edit fields), I'm on a Windows Server 2012 R2 with apache 2.4.25 x64 and php 7.0.17 x64.</p>
  
  <p>So far I made a simple code which work great, but I have an issue when using functions with multiple parameters like this one</p>
  
  <pre><code>$word-&gt;Documents[1]-&gt;Protect(3, false, 'mypassword', false, false);
  </code></pre>
  
  <p>I get the following error :</p>
  
  <p>[Erreur] Impossible de lancer le connecteur Microsoft Office Word. : com_exception: Parameter 4: Le type ne correspond pas</p>
  
  <p>Approx translation in english :</p>
  
  <p>[Error] Impossible to laungh the Microsoft Office Word connector : com_exception: Parameter 4: type does not correspond</p>
  
  <p>In VBA code like this it's working</p>
  
  <pre><code>ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
  </code></pre>
  
  <p>According to the doc found in VBA</p>
  
  <p><a href="https://i.stack.imgur.com/zXc4X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zXc4X.png" alt="And this : https://msdn.microsof"></a>t.com/en-us/library/office/aa220366(v=office.11).aspx</p>
  
  <p>Parameters 2, 4 and 5 should be booleans, so I don't know why I'm getting this error. If i remove parameters 4 and 5, I get the same error but on parameter 2.</p>
  
  <p>With some searches i looked at the object new VARIANT() but it didn't work too.</p>
  
  <p>I have also the problem with $this->Documents<a href="https://i.stack.imgur.com/zXc4X.png" rel="nofollow noreferrer">1</a>->SaveAs()</p>
  
  <pre><code>$fileName = "D:\\test.doc";
  $this-&gt;Documents[1]-&gt;SaveAs($fileName);
  </code></pre>
  
  <p>It works.</p>
  
  <p>According to the doc (<a href="https://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.document.saveas(v=vs.120).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.document.saveas(v=vs.120).aspx</a>) I should be able to use a second parameter like this :</p>
  
  <pre><code>$fileName = "D:\\test.doc";
  $fileFormat = 0;
  $this-&gt;Documents[1]-&gt;SaveAs($fileName, $fileFormat);
  </code></pre>
  
  <p>Like this I have the error "Parameter 0: Le type ne correspond pas" (Type does not correspond).</p>
  
  <p>In VBA it's working differently, maybe I'm doing something wrong ... </p>
  
  <p>Much thanks if you help me :)</p>
  
  <p>edit : full example code</p>
  
  <pre><code>&lt;?php
  
  $word = new COM("word.application") or die("Cannot create Word object");
  echo "com object created&lt;br&gt;";
  $word-&gt;Visible = false;
  $word-&gt;WindowState = 2;
  $word-&gt;DisplayAlerts = false;
  $word-&gt;Documents-&gt;Open("D:\\test.doc");
  echo "document loaded&lt;br&gt;";
  
  $import = $word-&gt;Documents[1]-&gt;VBProject-&gt;VBComponents-&gt;Import("D:\\fr.mac");
  $import-&gt;name = "Macrofr";
  
  $myModule = $word-&gt;Documents[1]-&gt;VBProject-&gt;VBComponents-&gt;Import("D:\\test1.mac");
  $myModule-&gt;name = "MacroInit";
  
  $myModule2 = $word-&gt;Documents[1]-&gt;VBProject-&gt;VBComponents-&gt;Import("D:\\test2.mac");
  $myModule2-&gt;name = "MacroFonction";
  
  $myModule3 = $word-&gt;Documents[1]-&gt;VBProject-&gt;VBComponents-&gt;Import("D:\\test3.frm");
  $myModule3-&gt;name = "MacroProgression";
  
  
  $word-&gt;Documents[1]-&gt;Protect(3,false,'motdepasse',false,false); // (type de protection,noReset,mdp)
  
  $word-&gt;Documents[1]-&gt;SaveAs("D:\\doc_with_macro.doc", 0);
  $word-&gt;Documents[1]-&gt;Close();
  echo "closing doc&lt;br&gt;";
  
  $word-&gt;Quit();
  $word = null;
  echo "end&lt;br&gt;";
  </code></pre>