Annotation of embedaddon/php/ext/pgsql/tests/80_bug24499.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #24499 (Notice: Undefined property: stdClass::)
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: require_once('skipif.inc');
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: 
        !            10: require_once('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 SEQUENCE id_id_seq");
        !            18: @pg_query("DROP TABLE id");
        !            19: pg_query("CREATE TABLE id (id SERIAL, t INT)");
        !            20: 
        !            21: for ($i=0; $i<4; $i++) {
        !            22:        pg_query("INSERT INTO id (t) VALUES ($i)");
        !            23: }
        !            24: 
        !            25: class Id
        !            26: {
        !            27:        public $id;
        !            28: 
        !            29:        public function getId()
        !            30:        {
        !            31:                global $dbh;
        !            32: 
        !            33:                $q  = pg_query($dbh, "SELECT id FROM id");
        !            34:                print_r(pg_fetch_array($q));
        !            35:                print_r(pg_fetch_array($q));
        !            36:                $id = pg_fetch_object($q);
        !            37:                var_dump($id);
        !            38:                return $id->id;
        !            39:        }
        !            40: }
        !            41: 
        !            42: $id = new Id();
        !            43: var_dump($id->getId());
        !            44: 
        !            45: pg_close($dbh);
        !            46: 
        !            47: echo "Done\n";
        !            48: 
        !            49: ?>
        !            50: --EXPECTF--
        !            51: Array
        !            52: (
        !            53:     [0] => 1
        !            54:     [id] => 1
        !            55: )
        !            56: Array
        !            57: (
        !            58:     [0] => 2
        !            59:     [id] => 2
        !            60: )
        !            61: object(stdClass)#%d (1) {
        !            62:   ["id"]=>
        !            63:   string(1) "3"
        !            64: }
        !            65: string(1) "3"
        !            66: Done

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