From:             kaija_jan at hotmail dot com
Operating system: windows 2k
PHP version:      5.0.0RC1
PHP Bug Type:     COM related
Bug description:  chinese comparision in delphi 5 COM object

Description:
------------
I wrote a COM object by using delphi 5.
It do some comparision in the delphi object like the following code.
====================================================
function Ttest.comparestr(const a, b: WideString; c,
  d: OleVariant): OleVariant;
var
    e : widestring;
    r : olevariant;
begin
    e := '中文';
    r := '';

    if a = b then
        r := r + 'a=b<br>'
    else
        r := r + 'a<>b<br>';

    if c = d then
        r := r + 'c=d<br>'
    else
        r := r + 'c<>d<br>';

    if a = c then
        r := r + 'a=c<br>'
    else
        r := r + 'a<>c<br>';

    if a = e then
        r := r + 'a=e<br>'
    else
        r := r + 'a<>e<br>';

    if c = e then
        r := r + 'c=e<br>'
    else
        r := r + 'c<>e<br>';

    result := r;
end;
====================================================

It always shows a<>e and c<>e(others equal) when I use PHP COM funcion,
and do chinese comparision. But It prints all equal if I send pure english
words or some numeral vairants.
And It shows all equal while I using asp to call the COM object, whatever
I send chinese or english.

Reproduce code:
---------------
<?php
    $a = $b = $c = $d = "中文"; //some chinese words

    $comtest = new COM("comtest.test1");

    echo $comtest->comparestr($a, $b, $c, $d);

    unset($comtest);
?>

php outputs:
a=b
c=d
a=c
a<>e
c<>e

=================================
<%
    a = "中文" 'some chinese words
    b = a
    c = a
    d = a

    set comtest = server.createobject("comtest.test1")

    response.write comtest.comparestr(a, b, c, d)

    set comtest = nothing
%>

asp outputs:
a=b
c=d
a=c
a=e
c=e

Expected result:
----------------
output:
a=b
c=d
a=c
a=e
c=e

Actual result:
--------------
output:
a=b
c=d
a=c
a<>e
c<>e

-- 
Edit bug report at http://bugs.php.net/?id=28117&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28117&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28117&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28117&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28117&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28117&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28117&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28117&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28117&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28117&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28117&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28117&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28117&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28117&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28117&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28117&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28117&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28117&r=float

Reply via email to