Annotation of embedaddon/php/ext/pgsql/tests/80_bug27597.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #27597 (pg_fetch_array not returning false)
                      3: --SKIPIF--
                      4: <?php 
                      5: require_once('skipif.inc');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: require_once(dirname(__FILE__) . '/config.inc');
                     11:        
                     12: $dbh = @pg_connect($conn_str);
                     13: if (!$dbh) {
                     14:        die ("Could not connect to the server");
                     15: }
                     16: 
                     17: @pg_query("DROP TABLE id");
                     18: pg_query("CREATE TABLE id (id INT)");
                     19: 
                     20: for ($i=0; $i<4; $i++) {
                     21:        pg_query("INSERT INTO id (id) VALUES ($i)");
                     22: }
                     23: 
                     24: function xi_fetch_array($res, $type = PGSQL_ASSOC) {
                     25:        $a = pg_fetch_array($res, NULL, $type) ;
                     26:        return $a ;     
                     27: }
                     28: 
                     29: $res = pg_query("SELECT * FROM id");
                     30: $i = 0; // endless-loop protection
                     31: while($row = xi_fetch_array($res)) {
                     32:        print_r($row);
                     33:        if ($i++ > 4) {
                     34:                echo "ENDLESS-LOOP";
                     35:                exit(1);
                     36:        }
                     37: }
                     38: 
                     39: pg_close($dbh);
                     40: 
                     41: ?>
                     42: ===DONE===
                     43: --EXPECTF--
                     44: Array
                     45: (
                     46:     [id] => 0
                     47: )
                     48: Array
                     49: (
                     50:     [id] => 1
                     51: )
                     52: Array
                     53: (
                     54:     [id] => 2
                     55: )
                     56: Array
                     57: (
                     58:     [id] => 3
                     59: )
                     60: ===DONE===

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