ID:               15543
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         COM related
 Operating System: Windows NT 4.0/W2k
 PHP Version:      4.1.0
 New Comment:

now com_* and COM(..) should both return NULL in case of an error.


Previous Comments:
------------------------------------------------------------------------

[2002-02-18 03:17:15] [EMAIL PROTECTED]

Diffrent is, that $comobj->xxx return NULL if fail, but
com_* return FALSE if fail.

------------------------------------------------------
Test1:
$tag = new COM("FLINK.TAGOBJ") or die("Unable to instanciate Flink");

while (1) {
        $bool = $tag->bind("DATETIME"); 
        var_dump($bool);
        if ($bool === false){
                print "Bind failed\n";
        };

        $val = $tag->read; // This function return value from binded variable
        var_dump($val);
        if ($val === false){
                print "Read failed\n";
        };

        print "Val: $val\n";
        sleep(1);
};
$tag->Release();
$tag = null;
--------------------------------------------------
Test1 output:
X-Powered-By: PHP/4.1.0
Content-type: text/html

int(0)
<br>
<b>Warning</b>:  PropGet() failed: Nespecifikovaná chyba
 in <b>C:\php\com_test1.php</b> on line <b>15</b><br>
NULL
Val:
--------------------------------------------------
Test2:
$tag = com_load("FLINK.TAGOBJ") or die("Unable to instanciate Flink");

while (1) {
        $bool = com_invoke($tag, "bind", "DATETIME"); 
        var_dump($bool);
        if ($bool === false){
                print "Bind failed\n";
        };

        $val = com_invoke($tag, "read"); // This function return value from
binded variable
        var_dump($val);
        if ($val === false){
                print "Read failed\n";
        };

        $val = com_propget($tag, "read"); // This function return value from
binded variable
        var_dump($val);
        if ($val === false){
                print "Propget Read failed\n";
        };

        print "Val: $val\n";

        sleep(1);
};

com_release($tag);
$tag = null;
----------------------------------------------------------
Test2 output:
X-Powered-By: PHP/4.1.0
Content-type: text/html

int(0)
<br>
<b>Warning</b>:  Invoke() failed: Nespecifikovaná chyba
 in <b>C:\php\com_test2.php</b> on line <b>14</b><br>
bool(false)
Read failed
<br>
<b>Warning</b>:  PropGet() failed: Nespecifikovaná chyba
 in <b>C:\php\com_test2.php</b> on line <b>20</b><br>
bool(false)
Propget Read failed
Val: 



------------------------------------------------------------------------

[2002-02-17 08:03:31] [EMAIL PROTECTED]

could you add 'var_dump($bool)' above the if's and send me the output
please.
the functions should actually do the same thing as the oo api.

------------------------------------------------------------------------

[2002-02-13 12:29:30] [EMAIL PROTECTED]

Hello,

I want connect to COM server, that publish data from some application.
Script run forever, but application my be started or stoped.

If I try use following script, I cannot discover if invoking object
method is succesful or not. Here is script:

$tag = new COM("FLINK.TAGOBJ") or die("Unable to instanciate Flink");
while (1) {
        $bool = $tag->bind("DATETIME"); 
        if ($bool === false){
                print "Bind failed\n";
        };

        $val = $tag->read; // This function return value from binded variable
        if ($val === false){
                print "Read failed\n";
        };

        print "Val: $val\n";
        sleep(1);
};
$tag->Release();
$tag = null;


Messages "* failed" is not reported, if application not run.

The following script run correctly:

$tag = com_load("FLINK.TAGOBJ") or die("Unable to instanciate Flink");

while (1) {
        $bool = com_invoke($tag, "bind", "DATETIME"); 
        if ($bool === false){
                print "Bind failed\n";
        };

        $val = com_invoke($tag, "read"); // This function return value from
binded variable
        if ($val === false){
                print "Read failed\n";
        };

        $val = com_propget($tag, "read"); // This function return value from
binded variable
        if ($val === false){
                print "Propget Read failed\n";
        };

        print "Val: $val\n";

        sleep(1);
};

com_release($tag);
$tag = null;

Is this feature or bug.




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=15543&edit=1

Reply via email to