push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.2.29";
hash = "sha256-UZeejRmMut4qrU/+n1PdPwT5YC0wieWXmYXgWK3kJnw=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)

View File

@@ -0,0 +1,59 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.3.26";
hash = "sha256-chtj1TSfEx9Ql1N7O+a6aAHi2Ob6uh8fLqlbT9YudSU=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)

View File

@@ -0,0 +1,58 @@
{ callPackage, ... }@_args:
let
base = callPackage ./generic.nix (
_args
// {
version = "8.4.13";
hash = "sha256-hRgd3Kez4D8UhSGwQ71iQRlQ1GjGZ9tkAEefGxCBIZQ=";
}
);
in
base.withExtensions (
{ all, ... }:
with all;
[
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]
)

View File

@@ -0,0 +1,26 @@
diff -ru a/ext/gettext/config.m4 b/ext/gettext/config.m4
--- a/ext/gettext/config.m4 2018-11-07 15:35:26.000000000 +0000
+++ b/ext/gettext/config.m4 2018-11-27 00:33:07.000000000 +0000
@@ -6,9 +6,7 @@
[ --with-gettext[=DIR] Include GNU gettext support])
if test "$PHP_GETTEXT" != "no"; then
- for i in $PHP_GETTEXT /usr/local /usr; do
- test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
- done
+ GETTEXT_DIR=$PHP_GETTEXT
if test -z "$GETTEXT_DIR"; then
AC_MSG_ERROR(Cannot locate header file libintl.h)
diff -ru a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
--- a/sapi/apache2handler/config.m4 2018-11-07 15:35:23.000000000 +0000
+++ b/sapi/apache2handler/config.m4 2018-11-27 00:32:28.000000000 +0000
@@ -66,7 +66,7 @@
AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required])
fi
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
+ APXS_LIBEXECDIR="$prefix/modules"
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \

View File

@@ -0,0 +1,28 @@
diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4
index e46acf0928..ee8e5a88f8 100644
--- a/ext/gettext/config.m4
+++ b/ext/gettext/config.m4
@@ -4,9 +4,7 @@ PHP_ARG_WITH([gettext],
[Include GNU gettext support])])
if test "$PHP_GETTEXT" != "no"; then
- for i in $PHP_GETTEXT /usr/local /usr; do
- AS_IF([test -r $i/include/libintl.h], [GETTEXT_DIR=$i; break;])
- done
+ GETTEXT_DIR=$PHP_GETTEXT
AS_VAR_IF([GETTEXT_DIR],,
[AC_MSG_ERROR([Cannot locate header file libintl.h])])
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index e335721f19..a5087e1320 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -68,7 +68,7 @@ if test "$PHP_APXS2" != "no"; then
AS_VERSION_COMPARE([$APACHE_VERSION], [2.4.0],
[AC_MSG_ERROR([Please note that Apache version >= 2.4 is required])])
- APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)
+ APXS_LIBEXECDIR="$prefix/modules"
if test -z $($APXS -q SYSCONFDIR); then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \

View File

@@ -0,0 +1,12 @@
diff --git a/ext/tokenizer/Makefile.frag b/ext/tokenizer/Makefile.frag
index 745cbfce91..07bace6022 100644
--- a/ext/tokenizer/Makefile.frag
+++ b/ext/tokenizer/Makefile.frag
@@ -1,5 +1,5 @@
-$(top_srcdir)/ext/tokenizer/tokenizer_data.c: $(top_srcdir)/Zend/zend_language_parser.y
+$(top_srcdir)/tokenizer_data.c: $(top_srcdir)/../../Zend/zend_language_parser.y
@if test ! -z "$(PHP)"; then \
$(PHP) $(srcdir)/tokenizer_data_gen.php; \
fi;
-$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.c $(top_srcdir)/Zend/zend_language_scanner.c
+$(builddir)/tokenizer.lo: $(top_srcdir)/../../Zend/zend_language_parser.c $(top_srcdir)/../../Zend/zend_language_scanner.c

View File

@@ -0,0 +1,426 @@
# We have tests for PCRE and PHP-FPM in nixos/tests/php/ or
# both in the same attribute named nixosTests.php
let
generic =
{
callPackage,
lib,
stdenv,
nixosTests,
tests,
fetchurl,
makeBinaryWrapper,
symlinkJoin,
writeText,
autoconf,
automake,
bison,
flex,
libtool,
pkg-config,
re2c,
apacheHttpd,
libargon2,
libxml2,
pcre2,
systemdLibs,
system-sendmail,
valgrind,
xcbuild,
writeShellScript,
common-updater-scripts,
curl,
jq,
coreutils,
formats,
version,
phpSrc ? null,
hash ? null,
extraPatches ? [ ],
packageOverrides ? (final: prev: { }),
phpAttrsOverrides ? (final: prev: { }),
pearInstallPhar ? (callPackage ./install-pear-nozlib-phar.nix { }),
# Sapi flags
cgiSupport ? true,
cliSupport ? true,
fpmSupport ? true,
pearSupport ? true,
pharSupport ? true,
phpdbgSupport ? true,
# Misc flags
apxs2Support ? false,
argon2Support ? true,
cgotoSupport ? false,
embedSupport ? false,
staticSupport ? false,
ipv6Support ? true,
zendSignalsSupport ? true,
zendMaxExecutionTimersSupport ? false,
systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs,
valgrindSupport ?
!stdenv.hostPlatform.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind,
ztsSupport ? apxs2Support,
}@args:
let
# buildEnv wraps php to provide additional extensions and
# configuration. Its usage is documented in
# doc/languages-frameworks/php.section.md.
#
# Create a buildEnv with earlier overridden values and
# extensions functions in its closure. This is necessary for
# consecutive calls to buildEnv and overrides to work as
# expected.
mkBuildEnv =
prevArgs: prevExtensionFunctions:
lib.makeOverridable (
{
extensions ? ({ enabled, ... }: enabled),
extraConfig ? "",
...
}@innerArgs:
let
allArgs = args // prevArgs // innerArgs;
filteredArgs = removeAttrs allArgs [
"extensions"
"extraConfig"
];
php = generic filteredArgs;
php-packages =
(callPackage ../../../top-level/php-packages.nix {
phpPackage = phpWithExtensions;
}).overrideScope
packageOverrides;
allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
enabledExtensions = builtins.foldl' (
enabled: f:
f {
inherit enabled;
all = php-packages.extensions;
}
) [ ] allExtensionFunctions;
getExtName = ext: ext.extensionName;
# Recursively get a list of all internal dependencies
# for a list of extensions.
getDepsRecursively =
extensions:
let
deps = lib.concatMap (ext: (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ])) extensions;
in
if !(deps == [ ]) then deps ++ (getDepsRecursively deps) else deps;
# Generate extension load configuration snippets from the
# extension parameter. This is an attrset suitable for use
# with textClosureList, which is used to put the strings in
# the right order - if a plugin which is dependent on
# another plugin is placed before its dependency, it will
# fail to load.
extensionTexts = lib.listToAttrs (
map (
ext:
let
extName = getExtName ext;
phpDeps = (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ]);
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
in
lib.nameValuePair extName {
text = "${type}=${ext}/lib/php/extensions/${extName}.so";
deps = map getExtName phpDeps;
}
) (enabledExtensions ++ (getDepsRecursively enabledExtensions))
);
extNames = map getExtName enabledExtensions;
extraInit = writeText "php-extra-init-${version}.ini" ''
${lib.concatStringsSep "\n" (lib.textClosureList extensionTexts extNames)}
${extraConfig}
'';
phpWithExtensions = symlinkJoin {
name = "php-with-extensions-${version}";
inherit (php) version;
nativeBuildInputs = [ makeBinaryWrapper ];
passthru = php.passthru // {
buildEnv = mkBuildEnv allArgs allExtensionFunctions;
withExtensions = mkWithExtensions allArgs allExtensionFunctions;
overrideAttrs =
f:
let
phpAttrsOverrides = filteredArgs.phpAttrsOverrides or (final: prev: { });
newPhpAttrsOverrides = lib.composeExtensions (lib.toExtension phpAttrsOverrides) (
lib.toExtension f
);
php = generic (filteredArgs // { phpAttrsOverrides = newPhpAttrsOverrides; });
in
php.buildEnv { inherit extensions extraConfig; };
phpIni = "${phpWithExtensions}/lib/php.ini";
unwrapped = php;
# Select the right php tests for the php version
tests = {
nixos =
lib.recurseIntoAttrs
nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}";
package = tests.php;
};
inherit (php-packages)
extensions
buildPecl
mkComposerRepository
mkComposerVendor
buildComposerProject
buildComposerProject2
buildComposerWithPlugin
composerHooks
composerHooks2
mkExtension
;
packages = php-packages.tools;
meta = php.meta // {
outputsToInstall = [ "out" ];
};
};
paths = [ php ];
postBuild = ''
ln -s ${extraInit} $out/lib/php.ini
if test -e $out/bin/php; then
wrapProgram $out/bin/php --set-default PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/php-fpm; then
wrapProgram $out/bin/php-fpm --set-default PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/phpdbg; then
wrapProgram $out/bin/phpdbg --set-default PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/php-cgi; then
wrapProgram $out/bin/php-cgi --set-default PHP_INI_SCAN_DIR $out/lib
fi
'';
};
in
phpWithExtensions
);
mkWithExtensions =
prevArgs: prevExtensionFunctions: extensions:
mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; };
defaultPhpSrc = fetchurl {
url = "https://www.php.net/distributions/php-${version}.tar.bz2";
inherit hash;
};
in
stdenv.mkDerivation (
finalAttrs:
let
attrs = {
pname = "php";
inherit version;
enableParallelBuilding = true;
nativeBuildInputs = [
autoconf
automake
bison
flex
libtool
pkg-config
re2c
]
++ lib.optional stdenv.hostPlatform.isDarwin xcbuild;
buildInputs =
# PCRE extension
[ pcre2 ]
# Enable sapis
++ lib.optionals pearSupport [ libxml2.dev ]
# Misc deps
++ lib.optional apxs2Support apacheHttpd
++ lib.optional argon2Support libargon2
++ lib.optional systemdSupport systemdLibs
++ lib.optional valgrindSupport valgrind;
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
SKIP_PERF_SENSITIVE = 1;
configureFlags =
# Disable all extensions
[ "--disable-all" ]
# PCRE
++ [ "--with-external-pcre=${pcre2.dev}" ]
# Enable sapis
++ lib.optional (!cgiSupport) "--disable-cgi"
++ lib.optional (!cliSupport) "--disable-cli"
++ lib.optional fpmSupport "--enable-fpm"
++ lib.optionals pearSupport [
"--with-pear"
"--enable-xml"
"--with-libxml"
]
++ lib.optional pharSupport "--enable-phar"
++ lib.optional (!phpdbgSupport) "--disable-phpdbg"
# Misc flags
++ lib.optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs"
++ lib.optional argon2Support "--with-password-argon2=${libargon2}"
++ lib.optional cgotoSupport "--enable-re2c-cgoto"
++ lib.optional embedSupport "--enable-embed${lib.optionalString staticSupport "=static"}"
++ lib.optional (!ipv6Support) "--disable-ipv6"
++ lib.optional systemdSupport "--with-fpm-systemd"
++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}"
++ lib.optional ztsSupport "--enable-zts"
++ lib.optional staticSupport "--enable-static"
++ lib.optional (!zendSignalsSupport) [ "--disable-zend-signals" ]
++ lib.optional zendMaxExecutionTimersSupport "--enable-zend-max-execution-timers"
# Sendmail
++ [ "PROG_SENDMAIL=${system-sendmail}/bin/sendmail" ];
hardeningDisable = [ "bindnow" ];
preConfigure =
# Don't record the configure flags since this causes unnecessary
# runtime dependencies
''
substituteInPlace main/build-defs.h.in \
--replace-fail '@CONFIGURE_COMMAND@' '(omitted)'
substituteInPlace scripts/php-config.in \
--replace-fail '@CONFIGURE_OPTIONS@' "" \
--replace-fail '@PHP_LDFLAGS@' ""
export EXTENSION_DIR=$out/lib/php/extensions
./buildconf --copy --force
if [ -f "scripts/dev/genfiles" ]; then
./scripts/dev/genfiles
fi
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace configure --replace-fail "-lstdc++" "-lc++"
'';
# When compiling PHP sources from Github, this file is missing and we
# need to install it ourselves.
# On the other hand, a distribution includes this file by default.
preInstall = ''
if [[ ! -f ./pear/install-pear-nozlib.phar ]]; then
cp ${pearInstallPhar} ./pear/install-pear-nozlib.phar
fi
'';
postInstall = ''
test -d $out/etc || mkdir $out/etc
cp php.ini-production $out/etc/php.ini
'';
postFixup = ''
mkdir -p $dev/bin $dev/lib $dev/share/man/man1
mv $out/bin/phpize $out/bin/php-config $dev/bin/
mv $out/lib/build $dev/lib/
mv $out/share/man/man1/phpize.1.gz \
$out/share/man/man1/php-config.1.gz \
$dev/share/man/man1/
substituteInPlace $dev/bin/phpize \
--replace-fail "$out/lib" "$dev/lib"
'';
src = if phpSrc == null then defaultPhpSrc else phpSrc;
patches =
lib.optionals (lib.versionOlder version "8.4") [
./fix-paths-php7.patch
]
++ lib.optionals (lib.versionAtLeast version "8.4") [
./fix-paths-php84.patch
]
++ extraPatches;
separateDebugInfo = true;
outputs = [
"out"
"dev"
];
passthru = {
updateScript =
let
script = writeShellScript "php${lib.versions.major version}${lib.versions.minor version}-update-script" ''
set -o errexit
PATH=${
lib.makeBinPath [
common-updater-scripts
curl
jq
]
}
new_version=$(curl --silent "https://www.php.net/releases/active" | jq --raw-output '."${lib.versions.major version}"."${lib.versions.majorMinor version}".version')
update-source-version "$UPDATE_NIX_ATTR_PATH.unwrapped" "$new_version" "--file=$1"
'';
in
[
script
# Passed as an argument so that update.nix can ensure it does not become a store path.
(./. + "/${lib.versions.majorMinor version}.nix")
];
buildEnv = mkBuildEnv { } [ ];
withExtensions = mkWithExtensions { } [ ];
overrideAttrs =
f:
let
newPhpAttrsOverrides = lib.composeExtensions (lib.toExtension phpAttrsOverrides) (
lib.toExtension f
);
php = generic (args // { phpAttrsOverrides = newPhpAttrsOverrides; });
in
php;
inherit ztsSupport;
services.default = {
imports = [
(lib.modules.importApply ./service.nix {
inherit formats coreutils;
})
];
php-fpm.package = lib.mkDefault finalAttrs.finalPackage;
};
};
meta = with lib; {
description = "HTML-embedded scripting language";
homepage = "https://www.php.net/";
license = licenses.php301;
mainProgram = "php";
teams = [ teams.php ];
platforms = platforms.all;
outputsToInstall = [
"out"
"dev"
];
};
};
final = attrs // (lib.toExtension phpAttrsOverrides) final attrs;
in
final
);
in
generic

View File

@@ -0,0 +1,8 @@
{
fetchurl,
}:
fetchurl {
url = "https://github.com/pear/pearweb_phars/raw/v1.10.21/install-pear-nozlib.phar";
hash = "sha256-UblKVcsm030tNSA6mdeab+h7ZhANNz7MkFf4Z1iigjs=";
}

View File

@@ -0,0 +1,194 @@
# Tests in: nixos/tests/php/fpm-modular.nix
# Non-module dependencies (importApply)
{ formats, coreutils }:
# Service module
{
options,
config,
lib,
...
}:
let
cfg = config.php-fpm;
format = formats.iniWithGlobalSection { };
configFile = format.generate "php-fpm.conf" {
globalSection = lib.filterAttrs (_: v: !lib.isAttrs v) cfg.settings;
sections = lib.filterAttrs (_: lib.isAttrs) cfg.settings;
};
poolOpts =
{ name, ... }:
{
freeformType =
with lib.types;
attrsOf (oneOf [
str
int
bool
]);
options = {
listen = lib.mkOption {
type =
with lib.types;
oneOf [
path
port
str
];
default = "/run/php-fpm/${name}.sock";
description = ''
The address on which to accept FastCGI requests. Valid syntaxes are: `ip.add.re.ss:port`, `port`, `/path/to/unix/socket`.
'';
};
pm = lib.mkOption {
type = lib.types.enum [
"static"
"ondemand"
"dynamic"
];
description = ''
Choose how the process manager will control the number of child processes.
`static` - the number of child processes is fixed (`pm.max_children`).
`ondemand` - the processes spawn on demand (when requested, as opposed to `dynamic`, where `pm.start_servers` are started when the service is started).
`dynamic` - the number of child processes is set dynamically based on the following directives: `pm.max_children`, `pm.start_servers`, pm.min_spare_servers, `pm.max_spare_servers`.
'';
};
"pm.max_children" = lib.mkOption {
type = lib.types.int;
description = ''
The number of child processes to be created when `pm` is set to `static` and the maximum
number of child processes to be created when `pm` is set to `dynamic`.
This option sets the limit on the number of simultaneous requests that will be served.
'';
};
user = lib.mkOption {
type = lib.types.str;
description = ''
Unix user of FPM processes.
'';
};
};
};
in
{
_class = "service";
options.php-fpm = {
package = lib.mkOption {
type = lib.types.package;
description = "PHP package to use for php-fpm";
defaultText = lib.literalMD ''The PHP package that provided this module.'';
example = lib.literalExpression ''
php.buildEnv {
extensions =
{ all, ... }:
with all;
[
imagick
opcache
];
extraConfig = "memory_limit=256M";
}
'';
};
settings = lib.mkOption {
type = lib.types.submodule {
freeformType =
with lib.types;
attrsOf (oneOf [
str
int
bool
(submodule poolOpts)
]);
options = {
log_level = lib.mkOption {
type = lib.types.enum [
"alert"
"error"
"warning"
"notice"
"debug"
];
default = "notice";
description = ''
Error log level.
'';
};
};
};
default = { };
example = lib.literalExpression ''
{
log_level = "debug";
log_limit = 2048;
mypool = {
"user" = "php";
"group" = "php";
"listen.owner" = "caddy";
"listen.group" = "caddy";
"pm" = "dynamic";
"pm.max_children" = 75;
"pm.start_servers" = 10;
"pm.min_spare_servers" = 5;
"pm.max_spare_servers" = 20;
"pm.max_requests" = 500;
}
}
'';
description = ''
PHP FPM configuration. Refer to [upstream documentation](https://www.php.net/manual/en/install.fpm.configuration.php) for details on supported values.
'';
};
};
config = {
php-fpm.settings = {
error_log = "syslog";
daemonize = false;
};
process.argv = [
"${cfg.package}/bin/php-fpm"
"-y"
configFile
];
}
// lib.optionalAttrs (options ? systemd) {
systemd.service = {
after = [ "network.target" ];
documentation = [ "man:php-fpm(8)" ];
serviceConfig = {
Type = "notify";
ExecReload = "${coreutils}/bin/kill -USR2 $MAINPID";
RuntimeDirectory = "php-fpm";
RuntimeDirectoryPreserve = true;
Restart = "always";
};
};
}
// lib.optionalAttrs (options ? finit) {
finit.service = {
conditions = [ "service/syslogd/ready" ];
reload = "${coreutils}/bin/kill -USR2 $MAINPID";
notify = "systemd";
};
};
meta.maintainers = with lib.maintainers; [
aanderse
];
}

View File

@@ -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--
-<?php
-
-$db = new SQLite3(':memory:');
-
-$db->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)
-}