A
A
Alexander Borisovich2013-07-12 15:40:53
PHP
Alexander Borisovich, 2013-07-12 15:40:53

PHP and COM object return broken array parameter only in 1 place

Create a com object in php. Everything works smoothly.

$obj = new COM("blablabla.blala");

if ($obj ->Init()) {
    $result = $obj ->Recognize('C:/1.jpg'");
}


$result if expanded we will see this:

aaa[]:
  0: [фамилия, Иванов]
    0: "фамилия"
    1: "Иванов"
  1: [отчество, Борисович]
    0: "отчество"
    1: "Борисович"
  2: "64"                        <--  Блин, что тут это за ерунда??? 64 в COM php?
  3: [гражданство, рф]
    0: "гражданство"
    1: "рф"


We see that the second index simply has "64".

We do the same, we connect the same COM object, but not through php, but through Powershell. We get the following result:

aaa[]:
  0: [фамилия, Иванов]
    0: "фамилия"
    1: "Иванов"
  1: [отчество, Борисович]
    0: "отчество"
    1: "Борисович"
  2: [Имя, Александр]                    <--  Все тут отлично!!
    0: "Имя"
    1: "Александр"      
  3: [гражданство, рф]
    0: "гражданство"
    1: "рф"


THAT is, everything is fine through powershell. How does it happen? The encoding of the array is UTF16LE - is it possible that the array is beating in php_com_dotnet.dll? No games with encodings help, part of the array is beating, I have no idea what to do with it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Borisovich, 2013-07-15
@Alexufo

What specifically did not understand until the end.
Debugging arrays from a COM object is not very convenient. I parsed the array through another class, proposed through another method by the Dll document.
There is a suspicion that when collecting an array in the wrong encoding, some character came across before the field name. This was confirmed by outputting xml through another function. The browser validator immediately rejected such xml due to an incomprehensible character just before the field name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question