1--TEST-- 2Bug #24499 (Notice: Undefined property: stdClass::) 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php 7require_once('inc/skipif.inc'); 8?> 9--FILE-- 10<?php 11 12require_once('inc/config.inc'); 13$table_name = 'table_80_bug24499'; 14 15$dbh = @pg_connect($conn_str); 16if (!$dbh) { 17 die ("Could not connect to the server"); 18} 19 20pg_query($dbh, "CREATE TABLE {$table_name} (id SERIAL, t INT)"); 21 22for ($i=0; $i<4; $i++) { 23 pg_query($dbh, "INSERT INTO {$table_name} (t) VALUES ($i)"); 24} 25 26class Id 27{ 28 public $id; 29 30 public function getId() 31 { 32 global $dbh; 33 global $table_name; 34 35 $q = pg_query($dbh, "SELECT id FROM {$table_name}"); 36 print_r(pg_fetch_array($q)); 37 print_r(pg_fetch_array($q)); 38 $id = pg_fetch_object($q); 39 var_dump($id); 40 return $id->id; 41 } 42} 43 44$id = new Id(); 45var_dump($id->getId()); 46 47pg_close($dbh); 48 49echo "Done\n"; 50 51?> 52--CLEAN-- 53<?php 54require_once('inc/config.inc'); 55$table_name = 'table_80_bug24499'; 56 57$dbh = pg_connect($conn_str); 58pg_query($dbh, "DROP TABLE IF EXISTS {$table_name} CASCADE"); 59?> 60--EXPECTF-- 61Array 62( 63 [0] => 1 64 [id] => 1 65) 66Array 67( 68 [0] => 2 69 [id] => 2 70) 71object(stdClass)#%d (1) { 72 ["id"]=> 73 string(1) "3" 74} 75string(1) "3" 76Done 77