Last active
November 10, 2017 10:27
-
-
Save srhb/2d9f5354cdf16c96ec3356f4c5383303 to your computer and use it in GitHub Desktop.
Tests whether mod_php handles groups in pcre regexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let testString = "can-use-subgroups"; in | |
import <nixpkgs/nixos/tests/make-test.nix> { | |
name = "php-httpd-pcre-jit-test"; | |
machine = { config, lib, pkgs, ... }: { | |
time.timeZone = "Europe/Copenhagen"; | |
services.httpd = { | |
enable = true; | |
adminAddr = "[email protected]"; | |
extraSubservices = lib.singleton { | |
function = f: { | |
enablePHP = true; | |
phpOptions = "pcre.jit = true"; | |
extraConfig = | |
let | |
testRoot = pkgs.writeText "index.php" | |
'' | |
<?php | |
preg_match('/(${testString})/', '${testString}', $result); | |
var_dump($result); | |
?> | |
''; | |
in | |
'' | |
Alias / ${testRoot}/ | |
<Directory ${testRoot}> | |
Require all granted | |
</Directory> | |
''; | |
}; | |
}; | |
}; | |
}; | |
testScript = { nodes, ... }: | |
'' | |
$machine->waitForUnit('httpd.service'); | |
$machine->succeed('curl -s http://127.0.0.1:80/index.php | grep "${testString}"'); | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment