Annotation of embedaddon/php/Zend/tests/compare_001.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: comparing different variables for equality
                      3: --SKIPIF--
                      4: <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
                      5: --FILE--
                      6: <?php
                      7: 
                      8: class test {
                      9: }
                     10: 
                     11: $a = array(
                     12:        array(1,2,3),
                     13:        "",
                     14:        1,
                     15:        2.5,
                     16:        0,
                     17:        "string",
                     18:        "123",
                     19:        "2.5",
                     20:        NULL,
                     21:        true,
                     22:        false,
                     23:        new stdclass,
                     24:        new stdclass,
                     25:        new test,
                     26:        array(),
                     27:        -PHP_INT_MAX-1,
                     28:        (string)(-PHP_INT_MAX-1),
                     29: );
                     30: 
                     31: $var_cnt = count($a);
                     32: 
                     33: function my_dump($var) {
                     34:        ob_start();
                     35:        var_dump($var);
                     36:        $buf = ob_get_clean();
                     37:        echo str_replace("\n", "", $buf);
                     38: }
                     39: 
                     40: foreach($a as $var) {
                     41:        for ($i = 0; $i < $var_cnt; $i++) {
                     42:                my_dump($var);
                     43:                echo ($var == $a[$i]) ? " == " : " != ";
                     44:                my_dump($a[$i]);
                     45:                echo "\n";
                     46:        }
                     47: }      
                     48: 
                     49: echo "Done\n";
                     50: ?>
                     51: --EXPECTF--    
                     52: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} == array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                     53: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != string(0) ""
                     54: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != int(1)
                     55: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != float(2.5)
                     56: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != int(0)
                     57: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != string(6) "string"
                     58: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != string(3) "123"
                     59: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != string(3) "2.5"
                     60: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != NULL
                     61: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} == bool(true)
                     62: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != bool(false)
                     63: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != object(stdClass)#1 (0) {}
                     64: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != object(stdClass)#2 (0) {}
                     65: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != object(test)#3 (0) {}
                     66: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != array(0) {}
                     67: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != int(-2147483648)
                     68: array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)} != string(11) "-2147483648"
                     69: string(0) "" != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                     70: string(0) "" == string(0) ""
                     71: string(0) "" != int(1)
                     72: string(0) "" != float(2.5)
                     73: string(0) "" == int(0)
                     74: string(0) "" != string(6) "string"
                     75: string(0) "" != string(3) "123"
                     76: string(0) "" != string(3) "2.5"
                     77: string(0) "" == NULL
                     78: string(0) "" != bool(true)
                     79: string(0) "" == bool(false)
                     80: string(0) "" != object(stdClass)#1 (0) {}
                     81: string(0) "" != object(stdClass)#2 (0) {}
                     82: string(0) "" != object(test)#3 (0) {}
                     83: string(0) "" != array(0) {}
                     84: string(0) "" != int(-2147483648)
                     85: string(0) "" != string(11) "-2147483648"
                     86: int(1) != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                     87: int(1) != string(0) ""
                     88: int(1) == int(1)
                     89: int(1) != float(2.5)
                     90: int(1) != int(0)
                     91: int(1) != string(6) "string"
                     92: int(1) != string(3) "123"
                     93: int(1) != string(3) "2.5"
                     94: int(1) != NULL
                     95: int(1) == bool(true)
                     96: int(1) != bool(false)
                     97: int(1)
                     98: Notice: Object of class stdClass could not be converted to int in %s on line %d
                     99:  == object(stdClass)#1 (0) {}
                    100: int(1)
                    101: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    102:  == object(stdClass)#2 (0) {}
                    103: int(1)
                    104: Notice: Object of class test could not be converted to int in %s on line %d
                    105:  == object(test)#3 (0) {}
                    106: int(1) != array(0) {}
                    107: int(1) != int(-2147483648)
                    108: int(1) != string(11) "-2147483648"
                    109: float(2.5) != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    110: float(2.5) != string(0) ""
                    111: float(2.5) != int(1)
                    112: float(2.5) == float(2.5)
                    113: float(2.5) != int(0)
                    114: float(2.5) != string(6) "string"
                    115: float(2.5) != string(3) "123"
                    116: float(2.5) == string(3) "2.5"
                    117: float(2.5) != NULL
                    118: float(2.5) == bool(true)
                    119: float(2.5) != bool(false)
                    120: float(2.5)
                    121: Notice: Object of class stdClass could not be converted to double in %s on line %d
                    122:  != object(stdClass)#1 (0) {}
                    123: float(2.5)
                    124: Notice: Object of class stdClass could not be converted to double in %s on line %d
                    125:  != object(stdClass)#2 (0) {}
                    126: float(2.5)
                    127: Notice: Object of class test could not be converted to double in %s on line %d
                    128:  != object(test)#3 (0) {}
                    129: float(2.5) != array(0) {}
                    130: float(2.5) != int(-2147483648)
                    131: float(2.5) != string(11) "-2147483648"
                    132: int(0) != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    133: int(0) == string(0) ""
                    134: int(0) != int(1)
                    135: int(0) != float(2.5)
                    136: int(0) == int(0)
                    137: int(0) == string(6) "string"
                    138: int(0) != string(3) "123"
                    139: int(0) != string(3) "2.5"
                    140: int(0) == NULL
                    141: int(0) != bool(true)
                    142: int(0) == bool(false)
                    143: int(0)
                    144: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    145:  != object(stdClass)#1 (0) {}
                    146: int(0)
                    147: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    148:  != object(stdClass)#2 (0) {}
                    149: int(0)
                    150: Notice: Object of class test could not be converted to int in %s on line %d
                    151:  != object(test)#3 (0) {}
                    152: int(0) != array(0) {}
                    153: int(0) != int(-2147483648)
                    154: int(0) != string(11) "-2147483648"
                    155: string(6) "string" != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    156: string(6) "string" != string(0) ""
                    157: string(6) "string" != int(1)
                    158: string(6) "string" != float(2.5)
                    159: string(6) "string" == int(0)
                    160: string(6) "string" == string(6) "string"
                    161: string(6) "string" != string(3) "123"
                    162: string(6) "string" != string(3) "2.5"
                    163: string(6) "string" != NULL
                    164: string(6) "string" == bool(true)
                    165: string(6) "string" != bool(false)
                    166: string(6) "string" != object(stdClass)#1 (0) {}
                    167: string(6) "string" != object(stdClass)#2 (0) {}
                    168: string(6) "string" != object(test)#3 (0) {}
                    169: string(6) "string" != array(0) {}
                    170: string(6) "string" != int(-2147483648)
                    171: string(6) "string" != string(11) "-2147483648"
                    172: string(3) "123" != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    173: string(3) "123" != string(0) ""
                    174: string(3) "123" != int(1)
                    175: string(3) "123" != float(2.5)
                    176: string(3) "123" != int(0)
                    177: string(3) "123" != string(6) "string"
                    178: string(3) "123" == string(3) "123"
                    179: string(3) "123" != string(3) "2.5"
                    180: string(3) "123" != NULL
                    181: string(3) "123" == bool(true)
                    182: string(3) "123" != bool(false)
                    183: string(3) "123" != object(stdClass)#1 (0) {}
                    184: string(3) "123" != object(stdClass)#2 (0) {}
                    185: string(3) "123" != object(test)#3 (0) {}
                    186: string(3) "123" != array(0) {}
                    187: string(3) "123" != int(-2147483648)
                    188: string(3) "123" != string(11) "-2147483648"
                    189: string(3) "2.5" != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    190: string(3) "2.5" != string(0) ""
                    191: string(3) "2.5" != int(1)
                    192: string(3) "2.5" == float(2.5)
                    193: string(3) "2.5" != int(0)
                    194: string(3) "2.5" != string(6) "string"
                    195: string(3) "2.5" != string(3) "123"
                    196: string(3) "2.5" == string(3) "2.5"
                    197: string(3) "2.5" != NULL
                    198: string(3) "2.5" == bool(true)
                    199: string(3) "2.5" != bool(false)
                    200: string(3) "2.5" != object(stdClass)#1 (0) {}
                    201: string(3) "2.5" != object(stdClass)#2 (0) {}
                    202: string(3) "2.5" != object(test)#3 (0) {}
                    203: string(3) "2.5" != array(0) {}
                    204: string(3) "2.5" != int(-2147483648)
                    205: string(3) "2.5" != string(11) "-2147483648"
                    206: NULL != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    207: NULL == string(0) ""
                    208: NULL != int(1)
                    209: NULL != float(2.5)
                    210: NULL == int(0)
                    211: NULL != string(6) "string"
                    212: NULL != string(3) "123"
                    213: NULL != string(3) "2.5"
                    214: NULL == NULL
                    215: NULL != bool(true)
                    216: NULL == bool(false)
                    217: NULL != object(stdClass)#1 (0) {}
                    218: NULL != object(stdClass)#2 (0) {}
                    219: NULL != object(test)#3 (0) {}
                    220: NULL == array(0) {}
                    221: NULL != int(-2147483648)
                    222: NULL != string(11) "-2147483648"
                    223: bool(true) == array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    224: bool(true) != string(0) ""
                    225: bool(true) == int(1)
                    226: bool(true) == float(2.5)
                    227: bool(true) != int(0)
                    228: bool(true) == string(6) "string"
                    229: bool(true) == string(3) "123"
                    230: bool(true) == string(3) "2.5"
                    231: bool(true) != NULL
                    232: bool(true) == bool(true)
                    233: bool(true) != bool(false)
                    234: bool(true) == object(stdClass)#1 (0) {}
                    235: bool(true) == object(stdClass)#2 (0) {}
                    236: bool(true) == object(test)#3 (0) {}
                    237: bool(true) != array(0) {}
                    238: bool(true) == int(-2147483648)
                    239: bool(true) == string(11) "-2147483648"
                    240: bool(false) != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    241: bool(false) == string(0) ""
                    242: bool(false) != int(1)
                    243: bool(false) != float(2.5)
                    244: bool(false) == int(0)
                    245: bool(false) != string(6) "string"
                    246: bool(false) != string(3) "123"
                    247: bool(false) != string(3) "2.5"
                    248: bool(false) == NULL
                    249: bool(false) != bool(true)
                    250: bool(false) == bool(false)
                    251: bool(false) != object(stdClass)#1 (0) {}
                    252: bool(false) != object(stdClass)#2 (0) {}
                    253: bool(false) != object(test)#3 (0) {}
                    254: bool(false) == array(0) {}
                    255: bool(false) != int(-2147483648)
                    256: bool(false) != string(11) "-2147483648"
                    257: object(stdClass)#1 (0) {} != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    258: object(stdClass)#1 (0) {} != string(0) ""
                    259: object(stdClass)#1 (0) {}
                    260: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    261:  == int(1)
                    262: object(stdClass)#1 (0) {}
                    263: Notice: Object of class stdClass could not be converted to double in %s on line %d
                    264:  != float(2.5)
                    265: object(stdClass)#1 (0) {}
                    266: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    267:  != int(0)
                    268: object(stdClass)#1 (0) {} != string(6) "string"
                    269: object(stdClass)#1 (0) {} != string(3) "123"
                    270: object(stdClass)#1 (0) {} != string(3) "2.5"
                    271: object(stdClass)#1 (0) {} != NULL
                    272: object(stdClass)#1 (0) {} == bool(true)
                    273: object(stdClass)#1 (0) {} != bool(false)
                    274: object(stdClass)#1 (0) {} == object(stdClass)#1 (0) {}
                    275: object(stdClass)#1 (0) {} == object(stdClass)#2 (0) {}
                    276: object(stdClass)#1 (0) {} != object(test)#3 (0) {}
                    277: object(stdClass)#1 (0) {} != array(0) {}
                    278: object(stdClass)#1 (0) {}
                    279: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    280:  != int(-2147483648)
                    281: object(stdClass)#1 (0) {} != string(11) "-2147483648"
                    282: object(stdClass)#2 (0) {} != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    283: object(stdClass)#2 (0) {} != string(0) ""
                    284: object(stdClass)#2 (0) {}
                    285: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    286:  == int(1)
                    287: object(stdClass)#2 (0) {}
                    288: Notice: Object of class stdClass could not be converted to double in %s on line %d
                    289:  != float(2.5)
                    290: object(stdClass)#2 (0) {}
                    291: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    292:  != int(0)
                    293: object(stdClass)#2 (0) {} != string(6) "string"
                    294: object(stdClass)#2 (0) {} != string(3) "123"
                    295: object(stdClass)#2 (0) {} != string(3) "2.5"
                    296: object(stdClass)#2 (0) {} != NULL
                    297: object(stdClass)#2 (0) {} == bool(true)
                    298: object(stdClass)#2 (0) {} != bool(false)
                    299: object(stdClass)#2 (0) {} == object(stdClass)#1 (0) {}
                    300: object(stdClass)#2 (0) {} == object(stdClass)#2 (0) {}
                    301: object(stdClass)#2 (0) {} != object(test)#3 (0) {}
                    302: object(stdClass)#2 (0) {} != array(0) {}
                    303: object(stdClass)#2 (0) {}
                    304: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    305:  != int(-2147483648)
                    306: object(stdClass)#2 (0) {} != string(11) "-2147483648"
                    307: object(test)#3 (0) {} != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    308: object(test)#3 (0) {} != string(0) ""
                    309: object(test)#3 (0) {}
                    310: Notice: Object of class test could not be converted to int in %s on line %d
                    311:  == int(1)
                    312: object(test)#3 (0) {}
                    313: Notice: Object of class test could not be converted to double in %s on line %d
                    314:  != float(2.5)
                    315: object(test)#3 (0) {}
                    316: Notice: Object of class test could not be converted to int in %s on line %d
                    317:  != int(0)
                    318: object(test)#3 (0) {} != string(6) "string"
                    319: object(test)#3 (0) {} != string(3) "123"
                    320: object(test)#3 (0) {} != string(3) "2.5"
                    321: object(test)#3 (0) {} != NULL
                    322: object(test)#3 (0) {} == bool(true)
                    323: object(test)#3 (0) {} != bool(false)
                    324: object(test)#3 (0) {} != object(stdClass)#1 (0) {}
                    325: object(test)#3 (0) {} != object(stdClass)#2 (0) {}
                    326: object(test)#3 (0) {} == object(test)#3 (0) {}
                    327: object(test)#3 (0) {} != array(0) {}
                    328: object(test)#3 (0) {}
                    329: Notice: Object of class test could not be converted to int in %s on line %d
                    330:  != int(-2147483648)
                    331: object(test)#3 (0) {} != string(11) "-2147483648"
                    332: array(0) {} != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    333: array(0) {} != string(0) ""
                    334: array(0) {} != int(1)
                    335: array(0) {} != float(2.5)
                    336: array(0) {} != int(0)
                    337: array(0) {} != string(6) "string"
                    338: array(0) {} != string(3) "123"
                    339: array(0) {} != string(3) "2.5"
                    340: array(0) {} == NULL
                    341: array(0) {} != bool(true)
                    342: array(0) {} == bool(false)
                    343: array(0) {} != object(stdClass)#1 (0) {}
                    344: array(0) {} != object(stdClass)#2 (0) {}
                    345: array(0) {} != object(test)#3 (0) {}
                    346: array(0) {} == array(0) {}
                    347: array(0) {} != int(-2147483648)
                    348: array(0) {} != string(11) "-2147483648"
                    349: int(-2147483648) != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    350: int(-2147483648) != string(0) ""
                    351: int(-2147483648) != int(1)
                    352: int(-2147483648) != float(2.5)
                    353: int(-2147483648) != int(0)
                    354: int(-2147483648) != string(6) "string"
                    355: int(-2147483648) != string(3) "123"
                    356: int(-2147483648) != string(3) "2.5"
                    357: int(-2147483648) != NULL
                    358: int(-2147483648) == bool(true)
                    359: int(-2147483648) != bool(false)
                    360: int(-2147483648)
                    361: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    362:  != object(stdClass)#1 (0) {}
                    363: int(-2147483648)
                    364: Notice: Object of class stdClass could not be converted to int in %s on line %d
                    365:  != object(stdClass)#2 (0) {}
                    366: int(-2147483648)
                    367: Notice: Object of class test could not be converted to int in %s on line %d
                    368:  != object(test)#3 (0) {}
                    369: int(-2147483648) != array(0) {}
                    370: int(-2147483648) == int(-2147483648)
                    371: int(-2147483648) == string(11) "-2147483648"
                    372: string(11) "-2147483648" != array(3) {  [0]=>  int(1)  [1]=>  int(2)  [2]=>  int(3)}
                    373: string(11) "-2147483648" != string(0) ""
                    374: string(11) "-2147483648" != int(1)
                    375: string(11) "-2147483648" != float(2.5)
                    376: string(11) "-2147483648" != int(0)
                    377: string(11) "-2147483648" != string(6) "string"
                    378: string(11) "-2147483648" != string(3) "123"
                    379: string(11) "-2147483648" != string(3) "2.5"
                    380: string(11) "-2147483648" != NULL
                    381: string(11) "-2147483648" == bool(true)
                    382: string(11) "-2147483648" != bool(false)
                    383: string(11) "-2147483648" != object(stdClass)#1 (0) {}
                    384: string(11) "-2147483648" != object(stdClass)#2 (0) {}
                    385: string(11) "-2147483648" != object(test)#3 (0) {}
                    386: string(11) "-2147483648" != array(0) {}
                    387: string(11) "-2147483648" == int(-2147483648)
                    388: string(11) "-2147483648" == string(11) "-2147483648"
                    389: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>