From fb1cc4af9c3ff397b0732ddfdeafd826ad54119b Mon Sep 17 00:00:00 2001 From: Manuel Frischknecht Date: Sat, 25 Nov 2023 13:42:02 +0100 Subject: [PATCH] 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]: https://github.com/php/php-src/issues/12076 [2]: https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f --- .../php/skip-sqlite3_bind_bug68849.phpt.patch | 75 +++++++++++++++++++ pkgs/top-level/php-packages.nix | 10 ++- 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch diff --git a/pkgs/development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch b/pkgs/development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch new file mode 100644 index 000000000000..8e208e52dbab --- /dev/null +++ b/pkgs/development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch @@ -0,0 +1,75 @@ +diff --git a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt +deleted file mode 100644 +index 6324d079..00000000 +--- a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt ++++ /dev/null +@@ -1,69 +0,0 @@ +---TEST-- +-Bug #68849 bindValue is not using the right data type +---EXTENSIONS-- +-sqlite3 +---FILE-- +-exec("CREATE TABLE test (a INTEGER, b TEXT, c REAL);" . +- "INSERT INTO test VALUES (1, 'hello', 3.14);" . +- "INSERT INTO test VALUES (3, 'world', 3.15);" . +- "INSERT INTO test VALUES (0, '42', 0.42);" +-); +- +-$s = $db->prepare('SELECT * FROM test WHERE (a+2) = ?;'); +-$s->bindValue(1, 3); +-$r = $s->execute(); +-var_dump($r->fetchArray(SQLITE3_ASSOC)); +- +-$s = $db->prepare('SELECT * FROM test WHERE a = ?;'); +-$s->bindValue(1, true); +-$r = $s->execute(); +-var_dump($r->fetchArray(SQLITE3_ASSOC)); +- +-$s = $db->prepare('SELECT * FROM test WHERE a = ?;'); +-$s->bindValue(1, false); +-$r = $s->execute(); +-var_dump($r->fetchArray(SQLITE3_ASSOC)); +- +-$s = $db->prepare('SELECT * FROM test WHERE c = ?;'); +-$s->bindValue(1, 3.15); +-$r = $s->execute(); +-var_dump($r->fetchArray(SQLITE3_ASSOC)); +- +-?> +---EXPECT-- +-array(3) { +- ["a"]=> +- int(1) +- ["b"]=> +- string(5) "hello" +- ["c"]=> +- float(3.14) +-} +-array(3) { +- ["a"]=> +- int(1) +- ["b"]=> +- string(5) "hello" +- ["c"]=> +- float(3.14) +-} +-array(3) { +- ["a"]=> +- int(0) +- ["b"]=> +- string(2) "42" +- ["c"]=> +- float(0.42) +-} +-array(3) { +- ["a"]=> +- int(3) +- ["b"]=> +- string(5) "world" +- ["c"]=> +- float(3.15) +-} diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 20e39d98fb42..a6c8905132c6 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -600,7 +600,15 @@ lib.makeScope pkgs.newScope (self: with self; { doCheck = false; } { name = "sodium"; buildInputs = [ libsodium ]; } - { name = "sqlite3"; buildInputs = [ sqlite ]; } + { + name = "sqlite3"; + buildInputs = [ sqlite ]; + + # The `sqlite3_bind_bug68849.phpt` test is currently broken for i686 Linux systems since sqlite 3.43, cf.: + # - https://github.com/php/php-src/issues/12076 + # - https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f + patches = lib.optional (stdenv.isi686 && stdenv.isLinux) ../development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch; + } { name = "sysvmsg"; } { name = "sysvsem"; } { name = "sysvshm"; }