Annotation of embedaddon/php/ext/mysqli/tests/bug35517.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #35517 (mysqli_stmt_fetch returns NULL)
        !             3: --SKIPIF--
        !             4: <?php
        !             5: require_once('skipif.inc');
        !             6: require_once('skipifconnectfailure.inc');
        !             7: ?>
        !             8: --FILE--
        !             9: <?php
        !            10:        require_once("connect.inc");
        !            11: 
        !            12:        $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
        !            13: 
        !            14:        $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
        !            15:        $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
        !            16:        $stmt = $mysql->prepare("SELECT id FROM temp");
        !            17:        $stmt->execute();
        !            18:        $stmt->bind_result($id);
        !            19:        while ($stmt->fetch()) {
        !            20:                if (PHP_INT_SIZE == 8) {
        !            21:                        if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
        !            22:                                printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
        !            23:                } else {
        !            24:                        if (gettype($id) !== 'string') {
        !            25:                                printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
        !            26:                        }
        !            27:                        if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($id)) {
        !            28:                                printf("[003] Expecting unicode string\n");
        !            29:                        }
        !            30:                }
        !            31:                print $id;
        !            32:                print "\n";
        !            33:        }
        !            34:        $stmt->close();
        !            35: 
        !            36:        $mysql->query("DROP TABLE temp");
        !            37:        $mysql->close();
        !            38:        print "done!";
        !            39: ?>
        !            40: --CLEAN--
        !            41: <?php
        !            42: require_once("connect.inc");
        !            43: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
        !            44:    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
        !            45: 
        !            46: if (!mysqli_query($link, "DROP TABLE IF EXISTS temp"))
        !            47:        printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
        !            48: 
        !            49: mysqli_close($link);
        !            50: ?>
        !            51: --EXPECTF--
        !            52: 3000000897
        !            53: 3800001532
        !            54: 3900002281
        !            55: 3100059612
        !            56: done!

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