at 23.11-pre 1.7 kB view raw
1let 2 testString = "can-use-subgroups"; 3in 4import ../make-test-python.nix ({ pkgs, 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 = let 35 # PCRE JIT SEAlloc feature does not play well with fork() 36 # The feature needs to either be disabled or PHP configured correctly 37 # More information in https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630 38 pcreJitSeallocForkIssue = pkgs.writeText "pcre-jit-sealloc-issue.php" '' 39 <?php 40 preg_match('/nixos/', 'nixos'); 41 $pid = pcntl_fork(); 42 pcntl_wait($pid); 43 ''; 44 in '' 45 machine.wait_for_unit("httpd.service") 46 # Ensure php evaluation by matching on the var_dump syntax 47 response = machine.succeed("curl -fvvv -s http://127.0.0.1:80/index.php") 48 expected = 'string(${toString (builtins.stringLength testString)}) "${testString}"' 49 assert expected in response, "Does not appear to be able to use subgroups." 50 machine.succeed("${php}/bin/php -f ${pcreJitSeallocForkIssue}") 51 ''; 52})