Skip to content

Commit d534c4a

Browse files
mfrischknechtgithub-actions[bot]
authored andcommitted
Skip sqlite3_bind_bug68849.phpt php unit test on i686 linux
PHP unit tests are broken with SQLite >= 3.43 [1]. If I understand the discussion in the SQLite forums [2] on the issue correctly, the trigger for this should not be a problem with SQLite itself but the test itself (and thus using a current SQLite version shouldn't generally be a problem for actual PHP code). [1]: php/php-src#12076 [2]: https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f (cherry picked from commit fb1cc4a)
1 parent 31c05c0 commit d534c4a

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
diff --git a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
2+
deleted file mode 100644
3+
index 6324d079..00000000
4+
--- a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
5+
+++ /dev/null
6+
@@ -1,69 +0,0 @@
7+
---TEST--
8+
-Bug #68849 bindValue is not using the right data type
9+
---EXTENSIONS--
10+
-sqlite3
11+
---FILE--
12+
-<?php
13+
-
14+
-$db = new SQLite3(':memory:');
15+
-
16+
-$db->exec("CREATE TABLE test (a INTEGER, b TEXT, c REAL);" .
17+
- "INSERT INTO test VALUES (1, 'hello', 3.14);" .
18+
- "INSERT INTO test VALUES (3, 'world', 3.15);" .
19+
- "INSERT INTO test VALUES (0, '42', 0.42);"
20+
-);
21+
-
22+
-$s = $db->prepare('SELECT * FROM test WHERE (a+2) = ?;');
23+
-$s->bindValue(1, 3);
24+
-$r = $s->execute();
25+
-var_dump($r->fetchArray(SQLITE3_ASSOC));
26+
-
27+
-$s = $db->prepare('SELECT * FROM test WHERE a = ?;');
28+
-$s->bindValue(1, true);
29+
-$r = $s->execute();
30+
-var_dump($r->fetchArray(SQLITE3_ASSOC));
31+
-
32+
-$s = $db->prepare('SELECT * FROM test WHERE a = ?;');
33+
-$s->bindValue(1, false);
34+
-$r = $s->execute();
35+
-var_dump($r->fetchArray(SQLITE3_ASSOC));
36+
-
37+
-$s = $db->prepare('SELECT * FROM test WHERE c = ?;');
38+
-$s->bindValue(1, 3.15);
39+
-$r = $s->execute();
40+
-var_dump($r->fetchArray(SQLITE3_ASSOC));
41+
-
42+
-?>
43+
---EXPECT--
44+
-array(3) {
45+
- ["a"]=>
46+
- int(1)
47+
- ["b"]=>
48+
- string(5) "hello"
49+
- ["c"]=>
50+
- float(3.14)
51+
-}
52+
-array(3) {
53+
- ["a"]=>
54+
- int(1)
55+
- ["b"]=>
56+
- string(5) "hello"
57+
- ["c"]=>
58+
- float(3.14)
59+
-}
60+
-array(3) {
61+
- ["a"]=>
62+
- int(0)
63+
- ["b"]=>
64+
- string(2) "42"
65+
- ["c"]=>
66+
- float(0.42)
67+
-}
68+
-array(3) {
69+
- ["a"]=>
70+
- int(3)
71+
- ["b"]=>
72+
- string(5) "world"
73+
- ["c"]=>
74+
- float(3.15)
75+
-}

pkgs/top-level/php-packages.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,15 @@ lib.makeScope pkgs.newScope (self: with self; {
600600
doCheck = false;
601601
}
602602
{ name = "sodium"; buildInputs = [ libsodium ]; }
603-
{ name = "sqlite3"; buildInputs = [ sqlite ]; }
603+
{
604+
name = "sqlite3";
605+
buildInputs = [ sqlite ];
606+
607+
# The `sqlite3_bind_bug68849.phpt` test is currently broken for i686 Linux systems since sqlite 3.43, cf.:
608+
# - https://github.com/php/php-src/issues/12076
609+
# - https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f
610+
patches = lib.optional (stdenv.isi686 && stdenv.isLinux) ../development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch;
611+
}
604612
{ name = "sysvmsg"; }
605613
{ name = "sysvsem"; }
606614
{ name = "sysvshm"; }

0 commit comments

Comments
 (0)