From dbdca73602cb9e55a3ab88d583c399996c754b4d Mon Sep 17 00:00:00 2001
From: Chris Croome <chris@webarchitects.co.uk>
Date: Thu, 17 Oct 2024 17:27:34 +0100
Subject: [PATCH] opcache.jit_buffer_cache size check

---
 tasks/check_vars.yml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tasks/check_vars.yml b/tasks/check_vars.yml
index a2085ca..faff6b7 100644
--- a/tasks/check_vars.yml
+++ b/tasks/check_vars.yml
@@ -181,11 +181,14 @@
         verbosity: "{% if ansible_check_mode | bool or ansible_diff_mode | bool %}1{% else %}2{% endif %}"
 
     # https://github.com/composer/composer/issues/12153#issuecomment-2419452358
-    - name: Check that the opcache.jit_buffer_size is set to 0 or is >= 40961
+    - name: Check that the opcache.jit_buffer_size is set to 0 or >= 40961 or >= 1K or >= 1M or >= 1G
       ansible.builtin.assert:
         that:
-          - php_conf_opcache_jit_buffer_size is ansible.builtin.regex('^[0-9]{1,20}$')
-          - ( php_conf_opcache_jit_buffer_size == "0" ) or ( php_conf_opcache_jit_buffer_size >= "40961" )
+          - php_conf_opcache_jit_buffer_size is ansible.builtin.regex('^[0-9]{1,20}[G|K|M]?$')
+          - >-
+            ( php_conf_opcache_jit_buffer_size == "0" ) or
+            ( ( php_conf_opcache_jit_buffer_size is ansible.builtin.regex('^[0-9]{1,20}$') ) and ( php_conf_opcache_jit_buffer_size | int >= 40961 ) ) or
+            ( php_conf_opcache_jit_buffer_size is ansible.builtin.regex('^[1-9][0-9]{0,20}[G|K|M]$') )
         quiet: "{% if ansible_verbosity == 0 %}true{% else %}false{% endif %}"
       loop: "{{ php_conf_opcache_jit_buffer_sizes }}"
       loop_control:
-- 
GitLab