From c7891595c92f9f687f29d7187b5c87b4042df226 Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Sat, 11 Nov 2017 17:02:07 +0100 Subject: [PATCH 1/5] php: Fix php pcre by using external lib --- pkgs/development/interpreters/php/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index b28d5acf978..3f97116dea2 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison , mysql, libxml2, readline, zlib, curl, postgresql, gettext -, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype +, openssl, pcre, pkgconfig, sqlite, config, libjpeg, libpng, freetype , libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds , uwimap, pam, gmp, apacheHttpd, libiconv, systemd }: @@ -91,6 +91,11 @@ let configureFlags = [ "--enable-pcntl" ]; }; + pcre = { + configureFlags = ["--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"]; + buildInputs = [ pcre ]; + }; + readline = { configureFlags = ["--with-readline=${readline.dev}"]; buildInputs = [ readline ]; @@ -240,6 +245,7 @@ let curlWrappersSupport = (!php7) && (config.php.curlWrappers or true); gettextSupport = config.php.gettext or true; pcntlSupport = config.php.pcntl or true; + pcreSupport = config.php.pcreExternal or true; postgresqlSupport = config.php.postgresql or true; pdo_pgsqlSupport = config.php.pdo_pgsql or true; readlineSupport = config.php.readline or true; From 58d07e2d6bd4377abe1b5ba1735c256a52ea01bc Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Sun, 12 Nov 2017 08:05:27 +0100 Subject: [PATCH 2/5] php: Add nixos test to ensure php-pcre works in httpd --- nixos/release-combined.nix | 1 + nixos/release.nix | 1 + nixos/tests/php-pcre.nix | 44 +++++++++++++++++++ pkgs/development/interpreters/php/default.nix | 1 + 4 files changed, 47 insertions(+) create mode 100644 nixos/tests/php-pcre.nix diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 125e6b7050b..7536bf3e48e 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -109,6 +109,7 @@ in rec { (all nixos.tests.nfs3) (all nixos.tests.nfs4) (all nixos.tests.openssh) + (all nixos.tests.php-pcre) (all nixos.tests.printing) (all nixos.tests.proxy) (all nixos.tests.sddm.default) diff --git a/nixos/release.nix b/nixos/release.nix index 28eb76d888e..e02851ac45a 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -309,6 +309,7 @@ in rec { tests.pam-oath-login = callTest tests/pam-oath-login.nix {}; #tests.panamax = hydraJob (import tests/panamax.nix { system = "x86_64-linux"; }); tests.peerflix = callTest tests/peerflix.nix {}; + tests.php-pcre = callTest tests/php-pcre.nix {}; tests.postgresql = callSubTests tests/postgresql.nix {}; tests.pgmanage = callTest tests/pgmanage.nix {}; tests.postgis = callTest tests/postgis.nix {}; diff --git a/nixos/tests/php-pcre.nix b/nixos/tests/php-pcre.nix new file mode 100644 index 00000000000..f618a39a229 --- /dev/null +++ b/nixos/tests/php-pcre.nix @@ -0,0 +1,44 @@ + +let testString = "can-use-subgroups"; in + +import ./make-test.nix ({ pkgs, ...}: { + name = "php-httpd-pcre-jit-test"; + machine = { config, lib, pkgs, ... }: { + time.timeZone = "UTC"; + services.httpd = { + enable = true; + adminAddr = "please@dont.contact"; + extraSubservices = lib.singleton { + function = f: { + enablePHP = true; + phpOptions = "pcre.jit = true"; + + extraConfig = + let + testRoot = pkgs.writeText "index.php" + '' + + ''; + in + '' + Alias / ${testRoot}/ + + + Require all granted + + ''; + }; + }; + }; + }; + testScript = { nodes, ... }: + '' + $machine->waitForUnit('httpd.service'); + # Ensure php evaluation by matching on the var_dump syntax + $machine->succeed('curl -vvv -s http://127.0.0.1:80/index.php \ + | grep "string(${toString (builtins.stringLength testString)}) \"${testString}\""'); + ''; +}) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index 3f97116dea2..f44b006e6bf 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -91,6 +91,7 @@ let configureFlags = [ "--enable-pcntl" ]; }; + # pcre functionality is tested in nixos/tests/php-pcre.nix pcre = { configureFlags = ["--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"]; buildInputs = [ pcre ]; From 88195b9863b59b40a167ed134df89844ee1fb2fe Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Sun, 12 Nov 2017 11:03:54 +0100 Subject: [PATCH 3/5] php: pcre test blocks -small channels as well --- nixos/release-small.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/release-small.nix b/nixos/release-small.nix index 28f1340caf8..e9f3cfb4de5 100644 --- a/nixos/release-small.nix +++ b/nixos/release-small.nix @@ -40,6 +40,7 @@ in rec { nat nfs3 openssh + php-pcre proxy simple; installer = { From 201444f02dbf3f85ba79d0a1e03c16bbf66517e9 Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Sun, 12 Nov 2017 13:07:22 +0100 Subject: [PATCH 4/5] php: Move test comment to the top --- pkgs/development/interpreters/php/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index f44b006e6bf..faf88ca13a9 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -1,3 +1,5 @@ +# pcre functionality is tested in nixos/tests/php-pcre.nix + { lib, stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison , mysql, libxml2, readline, zlib, curl, postgresql, gettext , openssl, pcre, pkgconfig, sqlite, config, libjpeg, libpng, freetype @@ -91,7 +93,6 @@ let configureFlags = [ "--enable-pcntl" ]; }; - # pcre functionality is tested in nixos/tests/php-pcre.nix pcre = { configureFlags = ["--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"]; buildInputs = [ pcre ]; From 7e17685d094aa8b6bff5324c4568986286dcff02 Mon Sep 17 00:00:00 2001 From: Sarah Brofeldt Date: Sun, 12 Nov 2017 13:19:17 +0100 Subject: [PATCH 5/5] php: Disallow bundled pcre --- pkgs/development/interpreters/php/default.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index faf88ca13a9..e46c6b4a032 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -23,7 +23,7 @@ let enableParallelBuilding = true; nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ flex bison ] + buildInputs = [ flex bison pcre ] ++ lib.optional stdenv.isLinux systemd; CXXFLAGS = lib.optional stdenv.cc.isClang "-std=c++11"; @@ -93,11 +93,6 @@ let configureFlags = [ "--enable-pcntl" ]; }; - pcre = { - configureFlags = ["--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"]; - buildInputs = [ pcre ]; - }; - readline = { configureFlags = ["--with-readline=${readline.dev}"]; buildInputs = [ readline ]; @@ -247,7 +242,6 @@ let curlWrappersSupport = (!php7) && (config.php.curlWrappers or true); gettextSupport = config.php.gettext or true; pcntlSupport = config.php.pcntl or true; - pcreSupport = config.php.pcreExternal or true; postgresqlSupport = config.php.postgresql or true; pdo_pgsqlSupport = config.php.pdo_pgsql or true; readlineSupport = config.php.readline or true; @@ -293,6 +287,7 @@ let configureFlags = [ "--with-config-file-scan-dir=/etc/php.d" + "--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}" ] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}" ++ lib.optional stdenv.isLinux "--with-fpm-systemd";