1let
2 testString = "can-use-subgroups";
3in
4import ../make-test-python.nix ({ lib, php, ... }: {
5 name = "php-${php.version}-httpd-pcre-jit-test";
6 meta.maintainers = lib.teams.php.members;
7
8 nodes.machine = { lib, pkgs, ... }: {
9 time.timeZone = "UTC";
10 services.httpd = {
11 enable = true;
12 adminAddr = "please@dont.contact";
13 phpPackage = php;
14 enablePHP = true;
15 phpOptions = "pcre.jit = true";
16 extraConfig =
17 let
18 testRoot = pkgs.writeText "index.php"
19 ''
20 <?php
21 preg_match('/(${testString})/', '${testString}', $result);
22 var_dump($result);
23 '';
24 in
25 ''
26 Alias / ${testRoot}/
27
28 <Directory ${testRoot}>
29 Require all granted
30 </Directory>
31 '';
32 };
33 };
34 testScript = { ... }:
35 ''
36 machine.wait_for_unit("httpd.service")
37 # Ensure php evaluation by matching on the var_dump syntax
38 response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/index.php")
39 expected = 'string(${toString (builtins.stringLength testString)}) "${testString}"'
40 assert expected in response, "Does not appear to be able to use subgroups."
41 '';
42})