1
2let testString = "can-use-subgroups"; in
3
4import ./make-test.nix ({ ...}: {
5 name = "php-httpd-pcre-jit-test";
6 machine = { lib, pkgs, ... }: {
7 time.timeZone = "UTC";
8 services.httpd = {
9 enable = true;
10 adminAddr = "please@dont.contact";
11 extraSubservices = lib.singleton {
12 function = f: {
13 enablePHP = true;
14 phpOptions = "pcre.jit = true";
15
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 '';
25 in
26 ''
27 Alias / ${testRoot}/
28
29 <Directory ${testRoot}>
30 Require all granted
31 </Directory>
32 '';
33 };
34 };
35 };
36 };
37 testScript = { ... }:
38 ''
39 $machine->waitForUnit('httpd.service');
40 # Ensure php evaluation by matching on the var_dump syntax
41 $machine->succeed('curl -vvv -s http://127.0.0.1:80/index.php \
42 | grep "string(${toString (builtins.stringLength testString)}) \"${testString}\""');
43 '';
44})