1--TEST-- 2PostgreSQL pg_fetch_object() 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php include("skipif.inc"); ?> 7--FILE-- 8<?php 9error_reporting(E_ALL); 10 11include 'config.inc'; 12 13class test_class { 14 function __construct($arg1, $arg2) { 15 echo __METHOD__ . "($arg1,$arg2)\n"; 16 } 17} 18 19$db = pg_connect($conn_str); 20 21$sql = "SELECT * FROM $table_name WHERE num = 0"; 22$result = pg_query($db, $sql) or die('Cannot query db'); 23$rows = pg_num_rows($result); 24 25var_dump(pg_fetch_object($result, NULL, 'test_class', array(1, 2))); 26 27try { 28 var_dump(pg_fetch_object($result, NULL, 'does_not_exist')); 29} catch (TypeError $e) { 30 echo $e->getMessage(), "\n"; 31} 32 33echo "Ok\n"; 34?> 35--EXPECTF-- 36test_class::__construct(1,2) 37object(test_class)#%d (3) { 38 ["num"]=> 39 string(1) "0" 40 ["str"]=> 41 string(3) "ABC" 42 ["bin"]=> 43 NULL 44} 45pg_fetch_object(): Argument #3 ($class) must be a valid class name, does_not_exist given 46Ok 47