Skip to content

Commit b64f149

Browse files
author
William Felipe Welter
committed
Test case Bug #68638 pg_update() fails to store infinite values
1 parent cb3833a commit b64f149

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

ext/pgsql/tests/bug68638.phpt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--TEST--
2+
Bug #68638 pg_update() fails to store infinite values
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
include('config.inc');
9+
10+
$conn = pg_connect($conn_str);
11+
12+
$table='test_68638';
13+
14+
pg_query("CREATE TABLE $table (id INT, value FLOAT)");
15+
16+
pg_insert($conn,$table, array('id' => 1, 'value' => 1.2));
17+
pg_insert($conn,$table, array('id' => 2, 'value' => 10));
18+
pg_insert($conn,$table, array('id' => 3, 'value' => 15));
19+
20+
var_dump(pg_update($conn,$table, array('value' => 'inf'), array('id' => 1), PGSQL_DML_STRING));
21+
22+
pg_update($conn,$table, array('value' => 'inf'), array('id' => 1));
23+
pg_update($conn,$table, array('value' => '-inf'), array('id' => 2));
24+
pg_update($conn,$table, array('value' => '+inf'), array('id' => 3));
25+
26+
$rs = pg_query("SELECT * FROM $table");
27+
while ($row = pg_fetch_assoc($rs)) {
28+
var_dump($row);
29+
}
30+
31+
pg_query("DROP TABLE $table");
32+
33+
?>
34+
--EXPECT--
35+
string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;"
36+
array(2) {
37+
["id"]=>
38+
string(1) "1"
39+
["value"]=>
40+
string(8) "Infinity"
41+
}
42+
array(2) {
43+
["id"]=>
44+
string(1) "2"
45+
["value"]=>
46+
string(9) "-Infinity"
47+
}
48+
array(2) {
49+
["id"]=>
50+
string(1) "3"
51+
["value"]=>
52+
string(8) "Infinity"
53+
}

0 commit comments

Comments
 (0)