1--TEST-- 2Bug #24499 (Notice: Undefined property: stdClass::) 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php 7require_once('skipif.inc'); 8?> 9--FILE-- 10<?php 11 12require_once('config.inc'); 13 14$dbh = @pg_connect($conn_str); 15if (!$dbh) { 16 die ("Could not connect to the server"); 17} 18 19@pg_query($dbh, "DROP SEQUENCE id_id_seq"); 20@pg_query($dbh, "DROP TABLE id"); 21pg_query($dbh, "CREATE TABLE id (id SERIAL, t INT)"); 22 23for ($i=0; $i<4; $i++) { 24 pg_query($dbh, "INSERT INTO id (t) VALUES ($i)"); 25} 26 27class Id 28{ 29 public $id; 30 31 public function getId() 32 { 33 global $dbh; 34 35 $q = pg_query($dbh, "SELECT id FROM id"); 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--EXPECTF-- 53Array 54( 55 [0] => 1 56 [id] => 1 57) 58Array 59( 60 [0] => 2 61 [id] => 2 62) 63object(stdClass)#%d (1) { 64 ["id"]=> 65 string(1) "3" 66} 67string(1) "3" 68Done 69