1--TEST-- 2Bug #37100 (data is returned truncated with BINARY CURSOR) (9.0+) 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php 7include("skipif.inc"); 8skip_bytea_not_hex(); 9?> 10--FILE-- 11<?php 12 13include 'config.inc'; 14 15$db = pg_connect($conn_str); 16 17@pg_query($db, 'DROP TABLE test_bug'); 18 19pg_query($db, 'CREATE TABLE test_bug (binfield byteA) ;'); 20pg_query($db, "INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))"); 21 22 23$data = pg_query($db, "SELECT binfield FROM test_bug"); 24$res = pg_fetch_result($data,0); 25var_dump($res); 26var_dump(bin2hex(pg_unescape_bytea($res))); 27 28$sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM test_bug; FETCH ALL IN mycursor;"; 29 30$data = pg_query($db, $sql); 31$res = pg_fetch_result($data,0); 32 33var_dump(strlen($res)); 34var_dump(bin2hex($res)); 35 36pg_close($db); 37 38$db = pg_connect($conn_str); 39pg_query($db, 'DROP TABLE test_bug'); 40pg_close($db); 41 42 43?> 44--EXPECT-- 45string(14) "\x0103aa000812" 46string(12) "0103aa000812" 47int(6) 48string(12) "0103aa000812" 49